From 4700cece0bb745bf85c72c3549ad36328ef196f2 Mon Sep 17 00:00:00 2001 From: tsemharb Date: Tue, 7 Feb 2023 17:57:51 +0200 Subject: [PATCH] new cohort definitions --- inst/cohorts/101.json | 298 +++ inst/cohorts/102.json | 111 + inst/cohorts/103.json | 298 +++ inst/cohorts/104.json | 111 + inst/cohorts/105.json | 111 + inst/cohorts/106.json | 298 +++ inst/cohorts/107.json | 967 +++----- inst/cohorts/108.json | 1072 ++++---- inst/cohorts/109.json | 1072 ++++---- inst/cohorts/110.json | 1228 +++++---- inst/cohorts/111.json | 1389 +++++------ inst/cohorts/112.json | 1510 ++++++------ inst/cohorts/113.json | 1705 ++++++------- inst/cohorts/114.json | 1718 ++++++------- inst/cohorts/115.json | 4342 ++++++++++++++++---------------- inst/cohorts/116.json | 4564 +++++++++++++++++----------------- inst/cohorts/117.json | 4586 +++++++++++++++++----------------- inst/cohorts/118.json | 4654 +++++++++++++++++++---------------- inst/cohorts/218.json | 34 + inst/cohorts/320.json | 17 + inst/cohorts/335.json | 17 + inst/cohorts/336.json | 221 ++ inst/sql/sql_server/101.sql | 38 +- inst/sql/sql_server/102.sql | 34 +- inst/sql/sql_server/103.sql | 38 +- inst/sql/sql_server/104.sql | 34 +- inst/sql/sql_server/105.sql | 34 +- inst/sql/sql_server/106.sql | 38 +- inst/sql/sql_server/107.sql | 1628 +++--------- inst/sql/sql_server/108.sql | 1777 ++++--------- inst/sql/sql_server/109.sql | 1777 ++++--------- inst/sql/sql_server/110.sql | 1711 +++++-------- inst/sql/sql_server/111.sql | 1823 ++++---------- inst/sql/sql_server/112.sql | 2204 ++++++----------- inst/sql/sql_server/113.sql | 2123 +++++----------- inst/sql/sql_server/114.sql | 2121 +++++++--------- inst/sql/sql_server/115.sql | 2039 ++++----------- inst/sql/sql_server/116.sql | 2330 ++++++------------ inst/sql/sql_server/117.sql | 2210 ++++++----------- inst/sql/sql_server/118.sql | 2227 +++++++---------- inst/sql/sql_server/218.sql | 2 +- inst/sql/sql_server/320.sql | 2 +- inst/sql/sql_server/335.sql | 2 +- inst/sql/sql_server/336.sql | 2 +- 44 files changed, 23236 insertions(+), 31281 deletions(-) diff --git a/inst/cohorts/101.json b/inst/cohorts/101.json index 2305b4d..75e0274 100644 --- a/inst/cohorts/101.json +++ b/inst/cohorts/101.json @@ -185,6 +185,74 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264861, + "CONCEPT_NAME" : "pM1c: Distant metastasis site other than bone or non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397215009", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264288, + "CONCEPT_NAME" : "pM1b: Distant metastasis to bone(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397214008", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4246703, + "CONCEPT_NAME" : "pM1a: Distant metastasis to non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397213002", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 763131, + "CONCEPT_NAME" : "Neoplasm of prostate distant metastasis staging category M1: Distant metastasis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "436401000124103", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false } ] } @@ -558,6 +626,23 @@ "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4312326, + "CONCEPT_NAME" : "Neoplasm, malignant (primary)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "86049000", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Morph Abnormality" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false } ] } @@ -2095,6 +2180,193 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2110046, + "CONCEPT_NAME" : "Cryosurgical ablation of the prostate (includes ultrasonic guidance and monitoring)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "55873", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2110035, + "CONCEPT_NAME" : "Prostatectomy (including control of postoperative bleeding, vasectomy, meatotomy, urethral calibration and/or dilation, and internal urethrotomy); suprapubic, subtotal, 1 or 2 stages", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "55821", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2108678, + "CONCEPT_NAME" : "Adjuvant (ie, in combination with external beam radiotherapy to the prostate for prostate cancer) hormonal therapy (gonadotropin-releasing hormone [GnRH] agonist or antagonist) prescribed/administered (PRCA)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "4164F", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2101059, + "CONCEPT_NAME" : "Anesthesia for; perineal prostatectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "00908", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2777698, + "CONCEPT_NAME" : "Excision of Prostate, Open Approach", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "0VB00ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 40490346, + "CONCEPT_NAME" : "Transrectal high intensity focused ultrasound ablation of prostate", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "446941000", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2110043, + "CONCEPT_NAME" : "Exposure of prostate, any approach, for insertion of radioactive substance; with bilateral pelvic lymphadenectomy, including external iliac, hypogastric and obturator nodes", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "55865", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2789830, + "CONCEPT_NAME" : "Beam Radiation of Prostate using Photons >10 MeV", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "DV002ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 709928, + "CONCEPT_NAME" : "Transurethral ablation of malignant prostate tissue by high-energy water vapor thermotherapy, including intraoperative imaging and needle guidance", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "0582T", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 42733763, + "CONCEPT_NAME" : "Transurethral resection of prostate; first stage of two-stage resection (partial resection) (Deprecated)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "52612", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 42733764, + "CONCEPT_NAME" : "Transurethral resection of prostate; second stage of two-stage resection (resection completed) (Deprecated)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "52614", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false } ] } @@ -2509,6 +2781,32 @@ "Count" : 0, "IsDistinct" : false } + }, + { + "Criteria" : { + "Observation" : { + "CodesetId" : 3, + "ObservationTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } } ], "DemographicCriteriaList" : [], diff --git a/inst/cohorts/102.json b/inst/cohorts/102.json index 183fc9f..6049bb2 100644 --- a/inst/cohorts/102.json +++ b/inst/cohorts/102.json @@ -185,6 +185,74 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264861, + "CONCEPT_NAME" : "pM1c: Distant metastasis site other than bone or non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397215009", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264288, + "CONCEPT_NAME" : "pM1b: Distant metastasis to bone(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397214008", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4246703, + "CONCEPT_NAME" : "pM1a: Distant metastasis to non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397213002", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 763131, + "CONCEPT_NAME" : "Neoplasm of prostate distant metastasis staging category M1: Distant metastasis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "436401000124103", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false } ] } @@ -625,6 +693,23 @@ "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4312326, + "CONCEPT_NAME" : "Neoplasm, malignant (primary)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "86049000", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Morph Abnormality" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false } ] } @@ -822,6 +907,32 @@ "Count" : 0, "IsDistinct" : false } + }, + { + "Criteria" : { + "Observation" : { + "CodesetId" : 11, + "ObservationTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } } ], "DemographicCriteriaList" : [], diff --git a/inst/cohorts/103.json b/inst/cohorts/103.json index f7106a4..92fa4bf 100644 --- a/inst/cohorts/103.json +++ b/inst/cohorts/103.json @@ -185,6 +185,74 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264861, + "CONCEPT_NAME" : "pM1c: Distant metastasis site other than bone or non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397215009", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264288, + "CONCEPT_NAME" : "pM1b: Distant metastasis to bone(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397214008", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4246703, + "CONCEPT_NAME" : "pM1a: Distant metastasis to non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397213002", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 763131, + "CONCEPT_NAME" : "Neoplasm of prostate distant metastasis staging category M1: Distant metastasis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "436401000124103", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false } ] } @@ -990,6 +1058,23 @@ "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4312326, + "CONCEPT_NAME" : "Neoplasm, malignant (primary)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "86049000", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Morph Abnormality" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false } ] } @@ -2120,6 +2205,193 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2110046, + "CONCEPT_NAME" : "Cryosurgical ablation of the prostate (includes ultrasonic guidance and monitoring)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "55873", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2110035, + "CONCEPT_NAME" : "Prostatectomy (including control of postoperative bleeding, vasectomy, meatotomy, urethral calibration and/or dilation, and internal urethrotomy); suprapubic, subtotal, 1 or 2 stages", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "55821", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2108678, + "CONCEPT_NAME" : "Adjuvant (ie, in combination with external beam radiotherapy to the prostate for prostate cancer) hormonal therapy (gonadotropin-releasing hormone [GnRH] agonist or antagonist) prescribed/administered (PRCA)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "4164F", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2101059, + "CONCEPT_NAME" : "Anesthesia for; perineal prostatectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "00908", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2777698, + "CONCEPT_NAME" : "Excision of Prostate, Open Approach", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "0VB00ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 40490346, + "CONCEPT_NAME" : "Transrectal high intensity focused ultrasound ablation of prostate", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "446941000", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2110043, + "CONCEPT_NAME" : "Exposure of prostate, any approach, for insertion of radioactive substance; with bilateral pelvic lymphadenectomy, including external iliac, hypogastric and obturator nodes", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "55865", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2789830, + "CONCEPT_NAME" : "Beam Radiation of Prostate using Photons >10 MeV", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "DV002ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 709928, + "CONCEPT_NAME" : "Transurethral ablation of malignant prostate tissue by high-energy water vapor thermotherapy, including intraoperative imaging and needle guidance", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "0582T", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 42733763, + "CONCEPT_NAME" : "Transurethral resection of prostate; first stage of two-stage resection (partial resection) (Deprecated)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "52612", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 42733764, + "CONCEPT_NAME" : "Transurethral resection of prostate; second stage of two-stage resection (resection completed) (Deprecated)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "52614", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false } ] } @@ -2504,6 +2776,32 @@ "Count" : 0, "IsDistinct" : false } + }, + { + "Criteria" : { + "Observation" : { + "CodesetId" : 10, + "ObservationTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } } ], "DemographicCriteriaList" : [], diff --git a/inst/cohorts/104.json b/inst/cohorts/104.json index ed7e15b..9f994c2 100644 --- a/inst/cohorts/104.json +++ b/inst/cohorts/104.json @@ -89,6 +89,74 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264861, + "CONCEPT_NAME" : "pM1c: Distant metastasis site other than bone or non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397215009", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264288, + "CONCEPT_NAME" : "pM1b: Distant metastasis to bone(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397214008", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4246703, + "CONCEPT_NAME" : "pM1a: Distant metastasis to non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397213002", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 763131, + "CONCEPT_NAME" : "Neoplasm of prostate distant metastasis staging category M1: Distant metastasis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "436401000124103", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false } ] } @@ -996,6 +1064,23 @@ "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4312326, + "CONCEPT_NAME" : "Neoplasm, malignant (primary)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "86049000", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Morph Abnormality" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false } ] } @@ -1593,6 +1678,32 @@ "Count" : 0, "IsDistinct" : false } + }, + { + "Criteria" : { + "Observation" : { + "CodesetId" : 10, + "ObservationTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } } ], "DemographicCriteriaList" : [], diff --git a/inst/cohorts/105.json b/inst/cohorts/105.json index 218dc9b..8b20956 100644 --- a/inst/cohorts/105.json +++ b/inst/cohorts/105.json @@ -135,6 +135,74 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264861, + "CONCEPT_NAME" : "pM1c: Distant metastasis site other than bone or non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397215009", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264288, + "CONCEPT_NAME" : "pM1b: Distant metastasis to bone(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397214008", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4246703, + "CONCEPT_NAME" : "pM1a: Distant metastasis to non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397213002", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 763131, + "CONCEPT_NAME" : "Neoplasm of prostate distant metastasis staging category M1: Distant metastasis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "436401000124103", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false } ] } @@ -1067,6 +1135,23 @@ "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4312326, + "CONCEPT_NAME" : "Neoplasm, malignant (primary)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "86049000", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Morph Abnormality" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false } ] } @@ -1811,6 +1896,32 @@ "Count" : 0, "IsDistinct" : false } + }, + { + "Criteria" : { + "Observation" : { + "CodesetId" : 10, + "ObservationTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } } ], "DemographicCriteriaList" : [], diff --git a/inst/cohorts/106.json b/inst/cohorts/106.json index 4185ca5..8bad666 100644 --- a/inst/cohorts/106.json +++ b/inst/cohorts/106.json @@ -136,6 +136,74 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264861, + "CONCEPT_NAME" : "pM1c: Distant metastasis site other than bone or non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397215009", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264288, + "CONCEPT_NAME" : "pM1b: Distant metastasis to bone(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397214008", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4246703, + "CONCEPT_NAME" : "pM1a: Distant metastasis to non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397213002", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 763131, + "CONCEPT_NAME" : "Neoplasm of prostate distant metastasis staging category M1: Distant metastasis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "436401000124103", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false } ] } @@ -1884,6 +1952,193 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2110046, + "CONCEPT_NAME" : "Cryosurgical ablation of the prostate (includes ultrasonic guidance and monitoring)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "55873", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2110035, + "CONCEPT_NAME" : "Prostatectomy (including control of postoperative bleeding, vasectomy, meatotomy, urethral calibration and/or dilation, and internal urethrotomy); suprapubic, subtotal, 1 or 2 stages", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "55821", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2108678, + "CONCEPT_NAME" : "Adjuvant (ie, in combination with external beam radiotherapy to the prostate for prostate cancer) hormonal therapy (gonadotropin-releasing hormone [GnRH] agonist or antagonist) prescribed/administered (PRCA)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "4164F", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2101059, + "CONCEPT_NAME" : "Anesthesia for; perineal prostatectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "00908", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2777698, + "CONCEPT_NAME" : "Excision of Prostate, Open Approach", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "0VB00ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 40490346, + "CONCEPT_NAME" : "Transrectal high intensity focused ultrasound ablation of prostate", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "446941000", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2110043, + "CONCEPT_NAME" : "Exposure of prostate, any approach, for insertion of radioactive substance; with bilateral pelvic lymphadenectomy, including external iliac, hypogastric and obturator nodes", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "55865", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2789830, + "CONCEPT_NAME" : "Beam Radiation of Prostate using Photons >10 MeV", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "DV002ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 709928, + "CONCEPT_NAME" : "Transurethral ablation of malignant prostate tissue by high-energy water vapor thermotherapy, including intraoperative imaging and needle guidance", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "0582T", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 42733763, + "CONCEPT_NAME" : "Transurethral resection of prostate; first stage of two-stage resection (partial resection) (Deprecated)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "52612", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 42733764, + "CONCEPT_NAME" : "Transurethral resection of prostate; second stage of two-stage resection (resection completed) (Deprecated)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "52614", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false } ] } @@ -2198,6 +2453,23 @@ "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4312326, + "CONCEPT_NAME" : "Neoplasm, malignant (primary)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "86049000", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Morph Abnormality" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false } ] } @@ -3142,6 +3414,32 @@ "Count" : 0, "IsDistinct" : false } + }, + { + "Criteria" : { + "Observation" : { + "CodesetId" : 12, + "ObservationTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } } ], "DemographicCriteriaList" : [], diff --git a/inst/cohorts/107.json b/inst/cohorts/107.json index a41a27d..8bed4ab 100644 --- a/inst/cohorts/107.json +++ b/inst/cohorts/107.json @@ -89,6 +89,74 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264861, + "CONCEPT_NAME" : "pM1c: Distant metastasis site other than bone or non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397215009", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264288, + "CONCEPT_NAME" : "pM1b: Distant metastasis to bone(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397214008", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4246703, + "CONCEPT_NAME" : "pM1a: Distant metastasis to non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397213002", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 763131, + "CONCEPT_NAME" : "Neoplasm of prostate distant metastasis staging category M1: Distant metastasis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "436401000124103", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false } ] } @@ -996,6 +1064,23 @@ "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4312326, + "CONCEPT_NAME" : "Neoplasm, malignant (primary)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "86049000", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Morph Abnormality" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false } ] } @@ -3186,7 +3271,7 @@ "Type" : "First" }, "ExpressionLimit" : { - "Type" : "First" + "Type" : "All" }, "InclusionRules" : [ { @@ -3232,20 +3317,256 @@ } }, { - "name" : "metastasis ", + "name" : "no other drugs", "expression" : { "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 13, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 14, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 15, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 16, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 17, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 12, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 0, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + }, + { + "name" : "No other primary", + "expression" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "ConditionOccurrence" : { + "CodesetId" : 10, + "ConditionTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "Observation" : { + "CodesetId" : 10, + "ObservationTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + }, + { + "name" : "metastasis", + "expression" : { + "Type" : "ANY", "CriteriaList" : [], "DemographicCriteriaList" : [], "Groups" : [ { - "Type" : "ANY", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { "ConditionOccurrence" : { "CorrelatedCriteria" : { - "Type" : "ALL", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { @@ -3275,204 +3596,7 @@ } ], "DemographicCriteriaList" : [], - "Groups" : [ - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 12, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 11, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } - ] + "Groups" : [] }, "CodesetId" : 1, "First" : true, @@ -3503,7 +3627,8 @@ "Criteria" : { "Measurement" : { "CorrelatedCriteria" : { - "Type" : "ALL", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { @@ -3533,203 +3658,7 @@ } ], "DemographicCriteriaList" : [], - "Groups" : [ - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 12, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 11, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } - ] + "Groups" : [] }, "CodesetId" : 7, "First" : true, @@ -3810,7 +3739,8 @@ "Criteria" : { "Measurement" : { "CorrelatedCriteria" : { - "Type" : "ALL", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { @@ -3840,204 +3770,7 @@ } ], "DemographicCriteriaList" : [], - "Groups" : [ - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 12, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 11, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } - ] + "Groups" : [] }, "CodesetId" : 6, "First" : true, @@ -4070,42 +3803,6 @@ } ] } - }, - { - "name" : "No other primary", - "expression" : { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "ConditionOccurrence" : { - "CodesetId" : 10, - "ConditionTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 30, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } } ], "CensoringCriteria" : [ diff --git a/inst/cohorts/108.json b/inst/cohorts/108.json index e39e8d1..efab133 100644 --- a/inst/cohorts/108.json +++ b/inst/cohorts/108.json @@ -4,6 +4,41 @@ "CriteriaList" : [ { "DrugExposure" : { + "CorrelatedCriteria" : { + "Type" : "AT_LEAST", + "Count" : 1, + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 12, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + }, "CodesetId" : 11, "OccurrenceStartDate" : { "Value" : "2016-01-01", @@ -15,6 +50,41 @@ }, { "ProcedureOccurrence" : { + "CorrelatedCriteria" : { + "Type" : "AT_LEAST", + "Count" : 1, + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 12, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + }, "CodesetId" : 4, "OccurrenceStartDate" : { "Value" : "2016-01-01", @@ -26,6 +96,67 @@ }, { "DrugExposure" : { + "CorrelatedCriteria" : { + "Type" : "ANY", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 11, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "ProcedureOccurrence" : { + "CodesetId" : 4, + "ProcedureTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + }, "CodesetId" : 12, "OccurrenceStartDate" : { "Value" : "2016-01-01", @@ -100,6 +231,74 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264861, + "CONCEPT_NAME" : "pM1c: Distant metastasis site other than bone or non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397215009", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264288, + "CONCEPT_NAME" : "pM1b: Distant metastasis to bone(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397214008", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4246703, + "CONCEPT_NAME" : "pM1a: Distant metastasis to non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397213002", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 763131, + "CONCEPT_NAME" : "Neoplasm of prostate distant metastasis staging category M1: Distant metastasis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "436401000124103", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false } ] } @@ -1007,6 +1206,23 @@ "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4312326, + "CONCEPT_NAME" : "Neoplasm, malignant (primary)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "86049000", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Morph Abnormality" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false } ] } @@ -3197,7 +3413,7 @@ "Type" : "First" }, "ExpressionLimit" : { - "Type" : "First" + "Type" : "All" }, "InclusionRules" : [ { @@ -3243,20 +3459,229 @@ } }, { - "name" : "metastasis ", + "name" : "no other drugs", "expression" : { "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 13, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 14, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 15, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 16, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 17, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + }, + { + "name" : "No other primary", + "expression" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "ConditionOccurrence" : { + "CodesetId" : 10, + "ConditionTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "Observation" : { + "CodesetId" : 10, + "ObservationTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + }, + { + "name" : "metastasis", + "expression" : { + "Type" : "ANY", "CriteriaList" : [], "DemographicCriteriaList" : [], "Groups" : [ { - "Type" : "ANY", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { "ConditionOccurrence" : { "CorrelatedCriteria" : { - "Type" : "ALL", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { @@ -3286,204 +3711,7 @@ } ], "DemographicCriteriaList" : [], - "Groups" : [ - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 12, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 11, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } - ] + "Groups" : [] }, "CodesetId" : 1, "First" : true, @@ -3514,7 +3742,8 @@ "Criteria" : { "Measurement" : { "CorrelatedCriteria" : { - "Type" : "ALL", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { @@ -3544,204 +3773,7 @@ } ], "DemographicCriteriaList" : [], - "Groups" : [ - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 12, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 11, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } - ] + "Groups" : [] }, "CodesetId" : 7, "First" : true, @@ -3822,7 +3854,8 @@ "Criteria" : { "Measurement" : { "CorrelatedCriteria" : { - "Type" : "ALL", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { @@ -3852,204 +3885,7 @@ } ], "DemographicCriteriaList" : [], - "Groups" : [ - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 12, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 11, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } - ] + "Groups" : [] }, "CodesetId" : 6, "First" : true, @@ -4082,42 +3918,6 @@ } ] } - }, - { - "name" : "No other primary", - "expression" : { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "ConditionOccurrence" : { - "CodesetId" : 10, - "ConditionTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 30, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } } ], "CensoringCriteria" : [ diff --git a/inst/cohorts/109.json b/inst/cohorts/109.json index 9dfaa25..c56c3b9 100644 --- a/inst/cohorts/109.json +++ b/inst/cohorts/109.json @@ -4,6 +4,41 @@ "CriteriaList" : [ { "DrugExposure" : { + "CorrelatedCriteria" : { + "Type" : "AT_LEAST", + "Count" : 1, + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 13, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + }, "CodesetId" : 11, "OccurrenceStartDate" : { "Value" : "2016-01-01", @@ -15,6 +50,41 @@ }, { "ProcedureOccurrence" : { + "CorrelatedCriteria" : { + "Type" : "AT_LEAST", + "Count" : 1, + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 13, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + }, "CodesetId" : 4, "OccurrenceStartDate" : { "Value" : "2016-01-01", @@ -26,6 +96,67 @@ }, { "DrugExposure" : { + "CorrelatedCriteria" : { + "Type" : "ANY", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 11, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "ProcedureOccurrence" : { + "CodesetId" : 4, + "ProcedureTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + }, "CodesetId" : 13, "OccurrenceStartDate" : { "Value" : "2016-01-01", @@ -100,6 +231,74 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264861, + "CONCEPT_NAME" : "pM1c: Distant metastasis site other than bone or non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397215009", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264288, + "CONCEPT_NAME" : "pM1b: Distant metastasis to bone(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397214008", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4246703, + "CONCEPT_NAME" : "pM1a: Distant metastasis to non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397213002", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 763131, + "CONCEPT_NAME" : "Neoplasm of prostate distant metastasis staging category M1: Distant metastasis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "436401000124103", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false } ] } @@ -1007,6 +1206,23 @@ "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4312326, + "CONCEPT_NAME" : "Neoplasm, malignant (primary)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "86049000", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Morph Abnormality" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false } ] } @@ -3197,7 +3413,7 @@ "Type" : "First" }, "ExpressionLimit" : { - "Type" : "First" + "Type" : "All" }, "InclusionRules" : [ { @@ -3243,20 +3459,229 @@ } }, { - "name" : "metastasis ", + "name" : "no other drugs", "expression" : { "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 12, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 14, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 15, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 16, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 17, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + }, + { + "name" : "No other primary", + "expression" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "ConditionOccurrence" : { + "CodesetId" : 10, + "ConditionTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "Observation" : { + "CodesetId" : 10, + "ObservationTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + }, + { + "name" : "metastasis", + "expression" : { + "Type" : "ANY", "CriteriaList" : [], "DemographicCriteriaList" : [], "Groups" : [ { - "Type" : "ANY", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { "ConditionOccurrence" : { "CorrelatedCriteria" : { - "Type" : "ALL", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { @@ -3286,204 +3711,7 @@ } ], "DemographicCriteriaList" : [], - "Groups" : [ - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 12, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 11, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } - ] + "Groups" : [] }, "CodesetId" : 1, "First" : true, @@ -3514,7 +3742,8 @@ "Criteria" : { "Measurement" : { "CorrelatedCriteria" : { - "Type" : "ALL", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { @@ -3544,204 +3773,7 @@ } ], "DemographicCriteriaList" : [], - "Groups" : [ - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 12, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 11, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } - ] + "Groups" : [] }, "CodesetId" : 7, "First" : true, @@ -3822,7 +3854,8 @@ "Criteria" : { "Measurement" : { "CorrelatedCriteria" : { - "Type" : "ALL", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { @@ -3852,204 +3885,7 @@ } ], "DemographicCriteriaList" : [], - "Groups" : [ - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 12, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 11, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } - ] + "Groups" : [] }, "CodesetId" : 6, "First" : true, @@ -4082,42 +3918,6 @@ } ] } - }, - { - "name" : "No other primary", - "expression" : { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "ConditionOccurrence" : { - "CodesetId" : 10, - "ConditionTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 30, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } } ], "CensoringCriteria" : [ diff --git a/inst/cohorts/110.json b/inst/cohorts/110.json index a131266..4ecf765 100644 --- a/inst/cohorts/110.json +++ b/inst/cohorts/110.json @@ -4,6 +4,67 @@ "CriteriaList" : [ { "DrugExposure" : { + "CorrelatedCriteria" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 12, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 13, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + }, "CodesetId" : 11, "OccurrenceStartDate" : { "Value" : "2016-01-01", @@ -15,6 +76,67 @@ }, { "ProcedureOccurrence" : { + "CorrelatedCriteria" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 12, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 13, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + }, "CodesetId" : 4, "OccurrenceStartDate" : { "Value" : "2016-01-01", @@ -26,6 +148,102 @@ }, { "DrugExposure" : { + "CorrelatedCriteria" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 13, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [ + { + "Type" : "ANY", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 11, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "ProcedureOccurrence" : { + "CodesetId" : 4, + "ProcedureTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + ] + }, "CodesetId" : 12, "OccurrenceStartDate" : { "Value" : "2016-01-01", @@ -37,6 +255,102 @@ }, { "DrugExposure" : { + "CorrelatedCriteria" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 12, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [ + { + "Type" : "ANY", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 11, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "ProcedureOccurrence" : { + "CodesetId" : 4, + "ProcedureTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + ] + }, "CodesetId" : 13, "OccurrenceStartDate" : { "Value" : "2016-01-01", @@ -111,6 +425,74 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264861, + "CONCEPT_NAME" : "pM1c: Distant metastasis site other than bone or non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397215009", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264288, + "CONCEPT_NAME" : "pM1b: Distant metastasis to bone(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397214008", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4246703, + "CONCEPT_NAME" : "pM1a: Distant metastasis to non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397213002", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 763131, + "CONCEPT_NAME" : "Neoplasm of prostate distant metastasis staging category M1: Distant metastasis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "436401000124103", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false } ] } @@ -1018,6 +1400,23 @@ "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4312326, + "CONCEPT_NAME" : "Neoplasm, malignant (primary)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "86049000", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Morph Abnormality" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false } ] } @@ -3208,7 +3607,7 @@ "Type" : "First" }, "ExpressionLimit" : { - "Type" : "First" + "Type" : "All" }, "InclusionRules" : [ { @@ -3254,20 +3653,202 @@ } }, { - "name" : "metastasis ", + "name" : "no other drugs", "expression" : { "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 14, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 15, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 16, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 17, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + }, + { + "name" : "No other primary", + "expression" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "ConditionOccurrence" : { + "CodesetId" : 10, + "ConditionTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "Observation" : { + "CodesetId" : 10, + "ObservationTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + }, + { + "name" : "metastasis", + "expression" : { + "Type" : "ANY", "CriteriaList" : [], "DemographicCriteriaList" : [], "Groups" : [ { - "Type" : "ANY", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { "ConditionOccurrence" : { "CorrelatedCriteria" : { - "Type" : "ALL", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { @@ -3297,204 +3878,7 @@ } ], "DemographicCriteriaList" : [], - "Groups" : [ - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 12, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 11, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } - ] + "Groups" : [] }, "CodesetId" : 1, "First" : true, @@ -3525,7 +3909,8 @@ "Criteria" : { "Measurement" : { "CorrelatedCriteria" : { - "Type" : "ALL", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { @@ -3555,204 +3940,7 @@ } ], "DemographicCriteriaList" : [], - "Groups" : [ - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 12, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 11, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } - ] + "Groups" : [] }, "CodesetId" : 7, "First" : true, @@ -3833,7 +4021,8 @@ "Criteria" : { "Measurement" : { "CorrelatedCriteria" : { - "Type" : "ALL", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { @@ -3863,204 +4052,7 @@ } ], "DemographicCriteriaList" : [], - "Groups" : [ - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 12, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 11, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } - ] + "Groups" : [] }, "CodesetId" : 6, "First" : true, @@ -4093,42 +4085,6 @@ } ] } - }, - { - "name" : "No other primary", - "expression" : { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "ConditionOccurrence" : { - "CodesetId" : 10, - "ConditionTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 30, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } } ], "CensoringCriteria" : [ diff --git a/inst/cohorts/111.json b/inst/cohorts/111.json index 8bd74a1..b40adff 100644 --- a/inst/cohorts/111.json +++ b/inst/cohorts/111.json @@ -89,6 +89,74 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264861, + "CONCEPT_NAME" : "pM1c: Distant metastasis site other than bone or non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397215009", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264288, + "CONCEPT_NAME" : "pM1b: Distant metastasis to bone(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397214008", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4246703, + "CONCEPT_NAME" : "pM1a: Distant metastasis to non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397213002", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 763131, + "CONCEPT_NAME" : "Neoplasm of prostate distant metastasis staging category M1: Distant metastasis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "436401000124103", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false } ] } @@ -176,13 +244,47 @@ }, { "concept" : { - "CONCEPT_ID" : 4145907, - "CONCEPT_NAME" : "Orchiectomy of remaining testis", + "CONCEPT_ID" : 4304921, + "CONCEPT_NAME" : "Bilateral orchidectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "34426006", + "CONCEPT_CODE" : "386634006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4073142, + "CONCEPT_NAME" : "Bilateral total orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176416007", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4073143, + "CONCEPT_NAME" : "Bilateral total scrotal orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176418008", "DOMAIN_ID" : "Procedure", "VOCABULARY_ID" : "SNOMED", "CONCEPT_CLASS_ID" : "Procedure" @@ -208,6 +310,57 @@ "includeDescendants" : true, "includeMapped" : false }, + { + "concept" : { + "CONCEPT_ID" : 4012324, + "CONCEPT_NAME" : "Bilateral cryptorchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "112910006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4073141, + "CONCEPT_NAME" : "Bilateral subcapsular orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176415006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4071936, + "CONCEPT_NAME" : "Bilateral total inguinal orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176417003", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, { "concept" : { "CONCEPT_ID" : 35608156, @@ -499,18 +652,35 @@ }, { "concept" : { - "CONCEPT_ID" : 4012324, - "CONCEPT_NAME" : "Bilateral cryptorchidectomy", + "CONCEPT_ID" : 4341536, + "CONCEPT_NAME" : "Total orchidectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "112910006", + "CONCEPT_CODE" : "236334001", "DOMAIN_ID" : "Procedure", "VOCABULARY_ID" : "SNOMED", "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : true, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4145907, + "CONCEPT_NAME" : "Orchiectomy of remaining testis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "34426006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false } @@ -894,6 +1064,23 @@ "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4312326, + "CONCEPT_NAME" : "Neoplasm, malignant (primary)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "86049000", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Morph Abnormality" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false } ] } @@ -1163,48 +1350,6 @@ }, { "id" : 12, - "name" : "[PIONEER 2.0] Hx of prostate cancer", - "expression" : { - "items" : [ - { - "concept" : { - "CONCEPT_ID" : 3169330, - "CONCEPT_NAME" : "Personal history of prostate cancer", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "4220001000004104", - "DOMAIN_ID" : "Observation", - "VOCABULARY_ID" : "Nebraska Lexicon", - "CONCEPT_CLASS_ID" : "Context-dependent" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - }, - { - "concept" : { - "CONCEPT_ID" : 4180749, - "CONCEPT_NAME" : "History of malignant neoplasm of prostate", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "428262008", - "DOMAIN_ID" : "Observation", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Context-dependent" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - } - ] - } - }, - { - "id" : 13, "name" : "[PIONEER V2.0] ARTA", "expression" : { "items" : [ @@ -1280,22 +1425,22 @@ } }, { - "id" : 14, - "name" : "[PIONEER V2.0] Immunotherapy (sipuleucel-T & pembrolizumab)", + "id" : 13, + "name" : "[PIONEER V2.0] Chemotherapy (docetaxel & cabazitaxe & paclitaxel)", "expression" : { "items" : [ { "concept" : { - "CONCEPT_ID" : 586622, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection Box of 1", + "CONCEPT_ID" : 1315942, + "CONCEPT_NAME" : "docetaxel", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3138293", + "CONCEPT_CODE" : "72962", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -1303,16 +1448,16 @@ }, { "concept" : { - "CONCEPT_ID" : 587503, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection Box of 1", + "CONCEPT_ID" : 40222431, + "CONCEPT_NAME" : "cabazitaxel", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3136350", + "CONCEPT_CODE" : "996051", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Clinical Box" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -1320,27 +1465,153 @@ }, { "concept" : { - "CONCEPT_ID" : 784328, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] Box of 1 by MSD", + "CONCEPT_ID" : 1378382, + "CONCEPT_NAME" : "paclitaxel", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4832151", + "CONCEPT_CODE" : "56946", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, - { - "concept" : { - "CONCEPT_ID" : 1830614, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Abacus Medicine", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", + } + ] + } + }, + { + "id" : 14, + "name" : "[PIONEER V2.0] Lutetium", + "expression" : { + "items" : [ + { + "concept" : { + "CONCEPT_ID" : 44816340, + "CONCEPT_NAME" : "lutetium", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "1534772", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + } + ] + } + }, + { + "id" : 15, + "name" : "[PIONEER V2.0] PARP inhibitor", + "expression" : { + "items" : [ + { + "concept" : { + "CONCEPT_ID" : 45892579, + "CONCEPT_NAME" : "olaparib", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "1597582", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 1718850, + "CONCEPT_NAME" : "rucaparib", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "1862579", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + } + ] + } + }, + { + "id" : 16, + "name" : "[PIONEER V2.0] Immunotherapy (sipuleucel-T & pembrolizumab)", + "expression" : { + "items" : [ + { + "concept" : { + "CONCEPT_ID" : 586622, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection Box of 1", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "OMOP3138293", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 587503, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection Box of 1", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "OMOP3136350", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Clinical Box" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 784328, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] Box of 1 by MSD", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "OMOP4832151", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 1830614, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Abacus Medicine", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", "CONCEPT_CODE" : "OMOP5155867", @@ -2919,107 +3190,6 @@ ] } }, - { - "id" : 15, - "name" : "[PIONEER V2.0] Chemotherapy (docetaxel & cabazitaxe & paclitaxel)", - "expression" : { - "items" : [ - { - "concept" : { - "CONCEPT_ID" : 1315942, - "CONCEPT_NAME" : "docetaxel", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "72962", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - }, - { - "concept" : { - "CONCEPT_ID" : 40222431, - "CONCEPT_NAME" : "cabazitaxel", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "996051", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - }, - { - "concept" : { - "CONCEPT_ID" : 1378382, - "CONCEPT_NAME" : "paclitaxel", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "56946", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - } - ] - } - }, - { - "id" : 16, - "name" : "[PIONEER V2.0] PARP inhibitor", - "expression" : { - "items" : [ - { - "concept" : { - "CONCEPT_ID" : 45892579, - "CONCEPT_NAME" : "olaparib", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1597582", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - }, - { - "concept" : { - "CONCEPT_ID" : 1718850, - "CONCEPT_NAME" : "rucaparib", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1862579", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - } - ] - } - }, { "id" : 17, "name" : "[PIONEER V2.0] Radium-223", @@ -3098,36 +3268,53 @@ }, { "id" : 18, - "name" : "[PIONEER V2.0] Lutetium", + "name" : "[PIONEER 2.0] Hx of prostate cancer", "expression" : { "items" : [ { "concept" : { - "CONCEPT_ID" : 44816340, - "CONCEPT_NAME" : "lutetium", + "CONCEPT_ID" : 3169330, + "CONCEPT_NAME" : "Personal history of prostate cancer", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1534772", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CODE" : "4220001000004104", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "Nebraska Lexicon", + "CONCEPT_CLASS_ID" : "Context-dependent" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - } - ], - "QualifiedLimit" : { - "Type" : "First" - }, - "ExpressionLimit" : { + }, + { + "concept" : { + "CONCEPT_ID" : 4180749, + "CONCEPT_NAME" : "History of malignant neoplasm of prostate", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "428262008", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Context-dependent" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + } + ] + } + } + ], + "QualifiedLimit" : { "Type" : "First" }, + "ExpressionLimit" : { + "Type" : "All" + }, "InclusionRules" : [ { "name" : "Male", @@ -3172,20 +3359,256 @@ } }, { - "name" : "metastasis ", + "name" : "no other drugs", "expression" : { "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 13, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 14, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 15, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 16, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 17, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 12, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + }, + { + "name" : "No other primary", + "expression" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "ConditionOccurrence" : { + "CodesetId" : 10, + "ConditionTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "Observation" : { + "CodesetId" : 10, + "ObservationTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + }, + { + "name" : "metastasis", + "expression" : { + "Type" : "ANY", "CriteriaList" : [], "DemographicCriteriaList" : [], "Groups" : [ { - "Type" : "ANY", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { "ConditionOccurrence" : { "CorrelatedCriteria" : { - "Type" : "ALL", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { @@ -3195,9 +3618,9 @@ "CriteriaList" : [ { "Criteria" : { - "Observation" : { - "CodesetId" : 12, - "ObservationTypeExclude" : false + "ConditionOccurrence" : { + "CodesetId" : 18, + "ConditionTypeExclude" : false } }, "StartWindow" : { @@ -3205,7 +3628,6 @@ "Coeff" : -1 }, "End" : { - "Days" : 1, "Coeff" : -1 }, "UseIndexEnd" : false, @@ -3230,7 +3652,6 @@ }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -3250,177 +3671,7 @@ } ], "DemographicCriteriaList" : [], - "Groups" : [ - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 18, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } - ] + "Groups" : [] }, "CodesetId" : 1, "First" : true, @@ -3451,7 +3702,8 @@ "Criteria" : { "Measurement" : { "CorrelatedCriteria" : { - "Type" : "ALL", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { @@ -3461,9 +3713,9 @@ "CriteriaList" : [ { "Criteria" : { - "Observation" : { - "CodesetId" : 12, - "ObservationTypeExclude" : false + "ConditionOccurrence" : { + "CodesetId" : 18, + "ConditionTypeExclude" : false } }, "StartWindow" : { @@ -3496,7 +3748,6 @@ }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -3516,177 +3767,7 @@ } ], "DemographicCriteriaList" : [], - "Groups" : [ - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 18, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } - ] + "Groups" : [] }, "CodesetId" : 7, "First" : true, @@ -3767,7 +3848,8 @@ "Criteria" : { "Measurement" : { "CorrelatedCriteria" : { - "Type" : "ALL", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { @@ -3777,9 +3859,9 @@ "CriteriaList" : [ { "Criteria" : { - "Observation" : { - "CodesetId" : 12, - "ObservationTypeExclude" : false + "ConditionOccurrence" : { + "CodesetId" : 18, + "ConditionTypeExclude" : false } }, "StartWindow" : { @@ -3812,7 +3894,6 @@ }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -3832,177 +3913,7 @@ } ], "DemographicCriteriaList" : [], - "Groups" : [ - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 18, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } - ] + "Groups" : [] }, "CodesetId" : 6, "First" : true, @@ -4035,42 +3946,6 @@ } ] } - }, - { - "name" : "No other primary", - "expression" : { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "ConditionOccurrence" : { - "CodesetId" : 10, - "ConditionTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 30, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } } ], "CensoringCriteria" : [ diff --git a/inst/cohorts/112.json b/inst/cohorts/112.json index 3663083..d113699 100644 --- a/inst/cohorts/112.json +++ b/inst/cohorts/112.json @@ -4,6 +4,41 @@ "CriteriaList" : [ { "DrugExposure" : { + "CorrelatedCriteria" : { + "Type" : "AT_LEAST", + "Count" : 1, + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 12, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + }, "CodesetId" : 11, "OccurrenceStartDate" : { "Value" : "2016-01-01", @@ -15,6 +50,41 @@ }, { "ProcedureOccurrence" : { + "CorrelatedCriteria" : { + "Type" : "AT_LEAST", + "Count" : 1, + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 12, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + }, "CodesetId" : 4, "OccurrenceStartDate" : { "Value" : "2016-01-01", @@ -26,7 +96,68 @@ }, { "DrugExposure" : { - "CodesetId" : 13, + "CorrelatedCriteria" : { + "Type" : "ANY", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 11, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "ProcedureOccurrence" : { + "CodesetId" : 4, + "ProcedureTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + }, + "CodesetId" : 12, "OccurrenceStartDate" : { "Value" : "2016-01-01", "Op" : "bt", @@ -100,6 +231,74 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264861, + "CONCEPT_NAME" : "pM1c: Distant metastasis site other than bone or non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397215009", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264288, + "CONCEPT_NAME" : "pM1b: Distant metastasis to bone(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397214008", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4246703, + "CONCEPT_NAME" : "pM1a: Distant metastasis to non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397213002", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 763131, + "CONCEPT_NAME" : "Neoplasm of prostate distant metastasis staging category M1: Distant metastasis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "436401000124103", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false } ] } @@ -187,13 +386,47 @@ }, { "concept" : { - "CONCEPT_ID" : 4145907, - "CONCEPT_NAME" : "Orchiectomy of remaining testis", + "CONCEPT_ID" : 4304921, + "CONCEPT_NAME" : "Bilateral orchidectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "34426006", + "CONCEPT_CODE" : "386634006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4073142, + "CONCEPT_NAME" : "Bilateral total orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176416007", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4073143, + "CONCEPT_NAME" : "Bilateral total scrotal orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176418008", "DOMAIN_ID" : "Procedure", "VOCABULARY_ID" : "SNOMED", "CONCEPT_CLASS_ID" : "Procedure" @@ -219,6 +452,57 @@ "includeDescendants" : true, "includeMapped" : false }, + { + "concept" : { + "CONCEPT_ID" : 4012324, + "CONCEPT_NAME" : "Bilateral cryptorchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "112910006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4073141, + "CONCEPT_NAME" : "Bilateral subcapsular orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176415006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4071936, + "CONCEPT_NAME" : "Bilateral total inguinal orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176417003", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, { "concept" : { "CONCEPT_ID" : 35608156, @@ -510,25 +794,42 @@ }, { "concept" : { - "CONCEPT_ID" : 4012324, - "CONCEPT_NAME" : "Bilateral cryptorchidectomy", + "CONCEPT_ID" : 4341536, + "CONCEPT_NAME" : "Total orchidectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "112910006", + "CONCEPT_CODE" : "236334001", "DOMAIN_ID" : "Procedure", "VOCABULARY_ID" : "SNOMED", "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { + }, + { + "concept" : { + "CONCEPT_ID" : 4145907, + "CONCEPT_NAME" : "Orchiectomy of remaining testis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "34426006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + } + ] + } + }, + { "id" : 6, "name" : "[PIONEER 2.0] Cancer Modifier Metastasis", "expression" : { @@ -905,6 +1206,23 @@ "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4312326, + "CONCEPT_NAME" : "Neoplasm, malignant (primary)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "86049000", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Morph Abnormality" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false } ] } @@ -1174,21 +1492,21 @@ }, { "id" : 12, - "name" : "[PIONEER 2.0] Hx of prostate cancer", + "name" : "[PIONEER V2.0] ARTA", "expression" : { "items" : [ { "concept" : { - "CONCEPT_ID" : 3169330, - "CONCEPT_NAME" : "Personal history of prostate cancer", + "CONCEPT_ID" : 40239056, + "CONCEPT_NAME" : "abiraterone", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "4220001000004104", - "DOMAIN_ID" : "Observation", - "VOCABULARY_ID" : "Nebraska Lexicon", - "CONCEPT_CLASS_ID" : "Context-dependent" + "CONCEPT_CODE" : "1100072", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -1196,16 +1514,50 @@ }, { "concept" : { - "CONCEPT_ID" : 4180749, - "CONCEPT_NAME" : "History of malignant neoplasm of prostate", + "CONCEPT_ID" : 963987, + "CONCEPT_NAME" : "apalutamide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "428262008", - "DOMAIN_ID" : "Observation", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Context-dependent" + "CONCEPT_CODE" : "1999574", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 42900250, + "CONCEPT_NAME" : "enzalutamide", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "1307298", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 1361291, + "CONCEPT_NAME" : "darolutamide", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "2180325", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -1216,18 +1568,18 @@ }, { "id" : 13, - "name" : "[PIONEER V2.0] ARTA", + "name" : "[PIONEER V2.0] Chemotherapy (docetaxel & cabazitaxe & paclitaxel)", "expression" : { "items" : [ { "concept" : { - "CONCEPT_ID" : 40239056, - "CONCEPT_NAME" : "abiraterone", + "CONCEPT_ID" : 1315942, + "CONCEPT_NAME" : "docetaxel", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1100072", + "CONCEPT_CODE" : "72962", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", "CONCEPT_CLASS_ID" : "Ingredient" @@ -1238,13 +1590,13 @@ }, { "concept" : { - "CONCEPT_ID" : 963987, - "CONCEPT_NAME" : "apalutamide", + "CONCEPT_ID" : 40222431, + "CONCEPT_NAME" : "cabazitaxel", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1999574", + "CONCEPT_CODE" : "996051", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", "CONCEPT_CLASS_ID" : "Ingredient" @@ -1255,13 +1607,63 @@ }, { "concept" : { - "CONCEPT_ID" : 42900250, - "CONCEPT_NAME" : "enzalutamide", + "CONCEPT_ID" : 1378382, + "CONCEPT_NAME" : "paclitaxel", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1307298", + "CONCEPT_CODE" : "56946", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + } + ] + } + }, + { + "id" : 14, + "name" : "[PIONEER V2.0] Lutetium", + "expression" : { + "items" : [ + { + "concept" : { + "CONCEPT_ID" : 44816340, + "CONCEPT_NAME" : "lutetium", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "1534772", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + } + ] + } + }, + { + "id" : 15, + "name" : "[PIONEER V2.0] PARP inhibitor", + "expression" : { + "items" : [ + { + "concept" : { + "CONCEPT_ID" : 45892579, + "CONCEPT_NAME" : "olaparib", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "1597582", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", "CONCEPT_CLASS_ID" : "Ingredient" @@ -1272,13 +1674,13 @@ }, { "concept" : { - "CONCEPT_ID" : 1361291, - "CONCEPT_NAME" : "darolutamide", + "CONCEPT_ID" : 1718850, + "CONCEPT_NAME" : "rucaparib", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "2180325", + "CONCEPT_CODE" : "1862579", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", "CONCEPT_CLASS_ID" : "Ingredient" @@ -1291,7 +1693,7 @@ } }, { - "id" : 14, + "id" : 16, "name" : "[PIONEER V2.0] Immunotherapy (sipuleucel-T & pembrolizumab)", "expression" : { "items" : [ @@ -2931,19 +3333,19 @@ } }, { - "id" : 15, - "name" : "[PIONEER V2.0] Chemotherapy (docetaxel & cabazitaxe & paclitaxel)", + "id" : 17, + "name" : "[PIONEER V2.0] Radium-223", "expression" : { "items" : [ { "concept" : { - "CONCEPT_ID" : 1315942, - "CONCEPT_NAME" : "docetaxel", + "CONCEPT_ID" : 45775578, + "CONCEPT_NAME" : "radium", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "72962", + "CONCEPT_CODE" : "1546450", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", "CONCEPT_CLASS_ID" : "Ingredient" @@ -2954,15 +3356,15 @@ }, { "concept" : { - "CONCEPT_ID" : 40222431, - "CONCEPT_NAME" : "cabazitaxel", + "CONCEPT_ID" : 902727, + "CONCEPT_NAME" : "Radium-223", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "996051", + "CONCEPT_CODE" : "OMOP5042947", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", + "VOCABULARY_ID" : "RxNorm Extension", "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, @@ -2971,55 +3373,30 @@ }, { "concept" : { - "CONCEPT_ID" : 1378382, - "CONCEPT_NAME" : "paclitaxel", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "56946", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - } - ] - } - }, - { - "id" : 16, - "name" : "[PIONEER V2.0] PARP inhibitor", - "expression" : { - "items" : [ - { - "concept" : { - "CONCEPT_ID" : 45892579, - "CONCEPT_NAME" : "olaparib", + "CONCEPT_ID" : 41267222, + "CONCEPT_NAME" : "Radium Oral Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1597582", + "CONCEPT_CODE" : "OMOP2465184", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, - "isExcluded" : false, - "includeDescendants" : true, + "isExcluded" : true, + "includeDescendants" : false, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 1718850, - "CONCEPT_NAME" : "rucaparib", + "CONCEPT_ID" : 43526934, + "CONCEPT_NAME" : "radium chloride Ra-223", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1862579", + "CONCEPT_CODE" : "1424174", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", "CONCEPT_CLASS_ID" : "Ingredient" @@ -3032,22 +3409,22 @@ } }, { - "id" : 17, - "name" : "[PIONEER V2.0] Radium-223", + "id" : 18, + "name" : "[PIONEER 2.0] Hx of prostate cancer", "expression" : { "items" : [ { "concept" : { - "CONCEPT_ID" : 45775578, - "CONCEPT_NAME" : "radium", + "CONCEPT_ID" : 3169330, + "CONCEPT_NAME" : "Personal history of prostate cancer", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1546450", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CODE" : "4220001000004104", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "Nebraska Lexicon", + "CONCEPT_CLASS_ID" : "Context-dependent" }, "isExcluded" : false, "includeDescendants" : true, @@ -3055,75 +3432,16 @@ }, { "concept" : { - "CONCEPT_ID" : 902727, - "CONCEPT_NAME" : "Radium-223", + "CONCEPT_ID" : 4180749, + "CONCEPT_NAME" : "History of malignant neoplasm of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP5042947", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Ingredient" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - }, - { - "concept" : { - "CONCEPT_ID" : 41267222, - "CONCEPT_NAME" : "Radium Oral Solution", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP2465184", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" - }, - "isExcluded" : true, - "includeDescendants" : false, - "includeMapped" : false - }, - { - "concept" : { - "CONCEPT_ID" : 43526934, - "CONCEPT_NAME" : "radium chloride Ra-223", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1424174", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - } - ] - } - }, - { - "id" : 18, - "name" : "[PIONEER V2.0] Lutetium", - "expression" : { - "items" : [ - { - "concept" : { - "CONCEPT_ID" : 44816340, - "CONCEPT_NAME" : "lutetium", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1534772", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CODE" : "428262008", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Context-dependent" }, "isExcluded" : false, "includeDescendants" : true, @@ -3137,7 +3455,7 @@ "Type" : "First" }, "ExpressionLimit" : { - "Type" : "First" + "Type" : "All" }, "InclusionRules" : [ { @@ -3183,20 +3501,229 @@ } }, { - "name" : "metastasis ", + "name" : "no other drugs", "expression" : { "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 13, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 14, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 15, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 16, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 17, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + }, + { + "name" : "No other primary", + "expression" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "ConditionOccurrence" : { + "CodesetId" : 10, + "ConditionTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "Observation" : { + "CodesetId" : 10, + "ObservationTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + }, + { + "name" : "metastasis", + "expression" : { + "Type" : "ANY", "CriteriaList" : [], "DemographicCriteriaList" : [], "Groups" : [ { - "Type" : "ANY", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { "ConditionOccurrence" : { "CorrelatedCriteria" : { - "Type" : "ALL", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { @@ -3206,9 +3733,9 @@ "CriteriaList" : [ { "Criteria" : { - "Observation" : { - "CodesetId" : 12, - "ObservationTypeExclude" : false + "ConditionOccurrence" : { + "CodesetId" : 18, + "ConditionTypeExclude" : false } }, "StartWindow" : { @@ -3216,7 +3743,6 @@ "Coeff" : -1 }, "End" : { - "Days" : 1, "Coeff" : -1 }, "UseIndexEnd" : false, @@ -3241,7 +3767,6 @@ }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -3261,204 +3786,7 @@ } ], "DemographicCriteriaList" : [], - "Groups" : [ - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 18, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 11, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } - ] + "Groups" : [] }, "CodesetId" : 1, "First" : true, @@ -3489,7 +3817,8 @@ "Criteria" : { "Measurement" : { "CorrelatedCriteria" : { - "Type" : "ALL", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { @@ -3499,9 +3828,9 @@ "CriteriaList" : [ { "Criteria" : { - "Observation" : { - "CodesetId" : 12, - "ObservationTypeExclude" : false + "ConditionOccurrence" : { + "CodesetId" : 18, + "ConditionTypeExclude" : false } }, "StartWindow" : { @@ -3534,7 +3863,6 @@ }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -3554,204 +3882,7 @@ } ], "DemographicCriteriaList" : [], - "Groups" : [ - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 18, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 11, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } - ] + "Groups" : [] }, "CodesetId" : 7, "First" : true, @@ -3832,7 +3963,8 @@ "Criteria" : { "Measurement" : { "CorrelatedCriteria" : { - "Type" : "ALL", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { @@ -3842,9 +3974,9 @@ "CriteriaList" : [ { "Criteria" : { - "Observation" : { - "CodesetId" : 12, - "ObservationTypeExclude" : false + "ConditionOccurrence" : { + "CodesetId" : 18, + "ConditionTypeExclude" : false } }, "StartWindow" : { @@ -3877,7 +4009,6 @@ }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -3897,204 +4028,7 @@ } ], "DemographicCriteriaList" : [], - "Groups" : [ - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 18, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 11, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } - ] + "Groups" : [] }, "CodesetId" : 6, "First" : true, @@ -4127,42 +4061,6 @@ } ] } - }, - { - "name" : "No other primary", - "expression" : { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "ConditionOccurrence" : { - "CodesetId" : 10, - "ConditionTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 30, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } } ], "CensoringCriteria" : [ diff --git a/inst/cohorts/113.json b/inst/cohorts/113.json index 7a1e8ce..0b84362 100644 --- a/inst/cohorts/113.json +++ b/inst/cohorts/113.json @@ -4,6 +4,41 @@ "CriteriaList" : [ { "DrugExposure" : { + "CorrelatedCriteria" : { + "Type" : "AT_LEAST", + "Count" : 1, + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 13, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + }, "CodesetId" : 11, "OccurrenceStartDate" : { "Value" : "2016-01-01", @@ -15,6 +50,41 @@ }, { "ProcedureOccurrence" : { + "CorrelatedCriteria" : { + "Type" : "AT_LEAST", + "Count" : 1, + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 13, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + }, "CodesetId" : 4, "OccurrenceStartDate" : { "Value" : "2016-01-01", @@ -26,7 +96,68 @@ }, { "DrugExposure" : { - "CodesetId" : 15, + "CorrelatedCriteria" : { + "Type" : "ANY", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 11, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "ProcedureOccurrence" : { + "CodesetId" : 4, + "ProcedureTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + }, + "CodesetId" : 13, "OccurrenceStartDate" : { "Value" : "2016-01-01", "Op" : "bt", @@ -100,6 +231,74 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264861, + "CONCEPT_NAME" : "pM1c: Distant metastasis site other than bone or non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397215009", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264288, + "CONCEPT_NAME" : "pM1b: Distant metastasis to bone(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397214008", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4246703, + "CONCEPT_NAME" : "pM1a: Distant metastasis to non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397213002", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 763131, + "CONCEPT_NAME" : "Neoplasm of prostate distant metastasis staging category M1: Distant metastasis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "436401000124103", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false } ] } @@ -187,13 +386,47 @@ }, { "concept" : { - "CONCEPT_ID" : 4145907, - "CONCEPT_NAME" : "Orchiectomy of remaining testis", + "CONCEPT_ID" : 4304921, + "CONCEPT_NAME" : "Bilateral orchidectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "34426006", + "CONCEPT_CODE" : "386634006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4073142, + "CONCEPT_NAME" : "Bilateral total orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176416007", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4073143, + "CONCEPT_NAME" : "Bilateral total scrotal orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176418008", "DOMAIN_ID" : "Procedure", "VOCABULARY_ID" : "SNOMED", "CONCEPT_CLASS_ID" : "Procedure" @@ -219,6 +452,57 @@ "includeDescendants" : true, "includeMapped" : false }, + { + "concept" : { + "CONCEPT_ID" : 4012324, + "CONCEPT_NAME" : "Bilateral cryptorchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "112910006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4073141, + "CONCEPT_NAME" : "Bilateral subcapsular orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176415006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4071936, + "CONCEPT_NAME" : "Bilateral total inguinal orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176417003", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, { "concept" : { "CONCEPT_ID" : 35608156, @@ -510,25 +794,42 @@ }, { "concept" : { - "CONCEPT_ID" : 4012324, - "CONCEPT_NAME" : "Bilateral cryptorchidectomy", + "CONCEPT_ID" : 4341536, + "CONCEPT_NAME" : "Total orchidectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "112910006", + "CONCEPT_CODE" : "236334001", "DOMAIN_ID" : "Procedure", "VOCABULARY_ID" : "SNOMED", "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { + }, + { + "concept" : { + "CONCEPT_ID" : 4145907, + "CONCEPT_NAME" : "Orchiectomy of remaining testis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "34426006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + } + ] + } + }, + { "id" : 6, "name" : "[PIONEER 2.0] Cancer Modifier Metastasis", "expression" : { @@ -595,133 +896,6 @@ ] } }, - { - "id" : 9, - "name" : "[PIONEER 2.0] ADT+meds", - "expression" : { - "items" : [ - { - "concept" : { - "CONCEPT_ID" : 40239056, - "CONCEPT_NAME" : "abiraterone", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1100072", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - }, - { - "concept" : { - "CONCEPT_ID" : 963987, - "CONCEPT_NAME" : "apalutamide", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1999574", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - }, - { - "concept" : { - "CONCEPT_ID" : 1344381, - "CONCEPT_NAME" : "bicalutamide", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "83008", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - }, - { - "concept" : { - "CONCEPT_ID" : 1361291, - "CONCEPT_NAME" : "darolutamide", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "2180325", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - }, - { - "concept" : { - "CONCEPT_ID" : 1315942, - "CONCEPT_NAME" : "docetaxel", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "72962", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - }, - { - "concept" : { - "CONCEPT_ID" : 1349025, - "CONCEPT_NAME" : "estramustine", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "4089", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - }, - { - "concept" : { - "CONCEPT_ID" : 42900250, - "CONCEPT_NAME" : "enzalutamide", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1307298", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - } - ] - } - }, { "id" : 10, "name" : "[PIONEER 2.0] other primaries", @@ -1032,6 +1206,23 @@ "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4312326, + "CONCEPT_NAME" : "Neoplasm, malignant (primary)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "86049000", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Morph Abnormality" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false } ] } @@ -1301,48 +1492,6 @@ }, { "id" : 12, - "name" : "[PIONEER 2.0] Hx of prostate cancer", - "expression" : { - "items" : [ - { - "concept" : { - "CONCEPT_ID" : 3169330, - "CONCEPT_NAME" : "Personal history of prostate cancer", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "4220001000004104", - "DOMAIN_ID" : "Observation", - "VOCABULARY_ID" : "Nebraska Lexicon", - "CONCEPT_CLASS_ID" : "Context-dependent" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - }, - { - "concept" : { - "CONCEPT_ID" : 4180749, - "CONCEPT_NAME" : "History of malignant neoplasm of prostate", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "428262008", - "DOMAIN_ID" : "Observation", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Context-dependent" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - } - ] - } - }, - { - "id" : 13, "name" : "[PIONEER V2.0] ARTA", "expression" : { "items" : [ @@ -1418,22 +1567,22 @@ } }, { - "id" : 14, - "name" : "[PIONEER V2.0] Immunotherapy (sipuleucel-T & pembrolizumab)", + "id" : 13, + "name" : "[PIONEER V2.0] Chemotherapy (docetaxel & cabazitaxe & paclitaxel)", "expression" : { "items" : [ { "concept" : { - "CONCEPT_ID" : 586622, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection Box of 1", + "CONCEPT_ID" : 1315942, + "CONCEPT_NAME" : "docetaxel", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3138293", + "CONCEPT_CODE" : "72962", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -1441,16 +1590,16 @@ }, { "concept" : { - "CONCEPT_ID" : 587503, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection Box of 1", + "CONCEPT_ID" : 40222431, + "CONCEPT_NAME" : "cabazitaxel", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3136350", + "CONCEPT_CODE" : "996051", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Clinical Box" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -1458,40 +1607,166 @@ }, { "concept" : { - "CONCEPT_ID" : 784328, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] Box of 1 by MSD", + "CONCEPT_ID" : 1378382, + "CONCEPT_NAME" : "paclitaxel", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4832151", + "CONCEPT_CODE" : "56946", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 14, + "name" : "[PIONEER V2.0] Lutetium", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 1830614, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Abacus Medicine", + "CONCEPT_ID" : 44816340, + "CONCEPT_NAME" : "lutetium", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP5155867", + "CONCEPT_CODE" : "1534772", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, - { - "concept" : { + } + ] + } + }, + { + "id" : 15, + "name" : "[PIONEER V2.0] PARP inhibitor", + "expression" : { + "items" : [ + { + "concept" : { + "CONCEPT_ID" : 45892579, + "CONCEPT_NAME" : "olaparib", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "1597582", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 1718850, + "CONCEPT_NAME" : "rucaparib", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "1862579", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + } + ] + } + }, + { + "id" : 16, + "name" : "[PIONEER V2.0] Immunotherapy (sipuleucel-T & pembrolizumab)", + "expression" : { + "items" : [ + { + "concept" : { + "CONCEPT_ID" : 586622, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection Box of 1", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "OMOP3138293", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 587503, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection Box of 1", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "OMOP3136350", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Clinical Box" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 784328, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] Box of 1 by MSD", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "OMOP4832151", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 1830614, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Abacus Medicine", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "OMOP5155867", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { "CONCEPT_ID" : 1832328, "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by Abacus Medicine", "STANDARD_CONCEPT" : "S", @@ -3057,107 +3332,6 @@ ] } }, - { - "id" : 15, - "name" : "[PIONEER V2.0] Chemotherapy (docetaxel & cabazitaxe & paclitaxel)", - "expression" : { - "items" : [ - { - "concept" : { - "CONCEPT_ID" : 1315942, - "CONCEPT_NAME" : "docetaxel", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "72962", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - }, - { - "concept" : { - "CONCEPT_ID" : 40222431, - "CONCEPT_NAME" : "cabazitaxel", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "996051", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - }, - { - "concept" : { - "CONCEPT_ID" : 1378382, - "CONCEPT_NAME" : "paclitaxel", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "56946", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - } - ] - } - }, - { - "id" : 16, - "name" : "[PIONEER V2.0] PARP inhibitor", - "expression" : { - "items" : [ - { - "concept" : { - "CONCEPT_ID" : 45892579, - "CONCEPT_NAME" : "olaparib", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1597582", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - }, - { - "concept" : { - "CONCEPT_ID" : 1718850, - "CONCEPT_NAME" : "rucaparib", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1862579", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - } - ] - } - }, { "id" : 17, "name" : "[PIONEER V2.0] Radium-223", @@ -3236,21 +3410,38 @@ }, { "id" : 18, - "name" : "[PIONEER V2.0] Lutetium", + "name" : "[PIONEER 2.0] Hx of prostate cancer", "expression" : { "items" : [ { "concept" : { - "CONCEPT_ID" : 44816340, - "CONCEPT_NAME" : "lutetium", + "CONCEPT_ID" : 3169330, + "CONCEPT_NAME" : "Personal history of prostate cancer", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1534772", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CODE" : "4220001000004104", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "Nebraska Lexicon", + "CONCEPT_CLASS_ID" : "Context-dependent" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4180749, + "CONCEPT_NAME" : "History of malignant neoplasm of prostate", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "428262008", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Context-dependent" }, "isExcluded" : false, "includeDescendants" : true, @@ -3264,7 +3455,7 @@ "Type" : "First" }, "ExpressionLimit" : { - "Type" : "First" + "Type" : "All" }, "InclusionRules" : [ { @@ -3310,20 +3501,229 @@ } }, { - "name" : "metastasis ", + "name" : "no other drugs", "expression" : { "Type" : "ALL", - "CriteriaList" : [], - "DemographicCriteriaList" : [], + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 12, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 14, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 15, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 16, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 17, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + }, + { + "name" : "No other primary", + "expression" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "ConditionOccurrence" : { + "CodesetId" : 10, + "ConditionTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "Observation" : { + "CodesetId" : 10, + "ObservationTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + }, + { + "name" : "metastasis", + "expression" : { + "Type" : "ANY", + "CriteriaList" : [], + "DemographicCriteriaList" : [], "Groups" : [ { - "Type" : "ANY", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { "ConditionOccurrence" : { "CorrelatedCriteria" : { - "Type" : "ALL", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { @@ -3333,9 +3733,9 @@ "CriteriaList" : [ { "Criteria" : { - "Observation" : { - "CodesetId" : 12, - "ObservationTypeExclude" : false + "ConditionOccurrence" : { + "CodesetId" : 18, + "ConditionTypeExclude" : false } }, "StartWindow" : { @@ -3343,7 +3743,6 @@ "Coeff" : -1 }, "End" : { - "Days" : 1, "Coeff" : -1 }, "UseIndexEnd" : false, @@ -3368,7 +3767,6 @@ }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -3388,204 +3786,7 @@ } ], "DemographicCriteriaList" : [], - "Groups" : [ - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 18, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 11, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } - ] + "Groups" : [] }, "CodesetId" : 1, "First" : true, @@ -3616,7 +3817,8 @@ "Criteria" : { "Measurement" : { "CorrelatedCriteria" : { - "Type" : "ALL", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { @@ -3626,9 +3828,9 @@ "CriteriaList" : [ { "Criteria" : { - "Observation" : { - "CodesetId" : 12, - "ObservationTypeExclude" : false + "ConditionOccurrence" : { + "CodesetId" : 18, + "ConditionTypeExclude" : false } }, "StartWindow" : { @@ -3661,7 +3863,6 @@ }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -3681,204 +3882,7 @@ } ], "DemographicCriteriaList" : [], - "Groups" : [ - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 18, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 11, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } - ] + "Groups" : [] }, "CodesetId" : 7, "First" : true, @@ -3959,7 +3963,8 @@ "Criteria" : { "Measurement" : { "CorrelatedCriteria" : { - "Type" : "ALL", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { @@ -3969,9 +3974,9 @@ "CriteriaList" : [ { "Criteria" : { - "Observation" : { - "CodesetId" : 12, - "ObservationTypeExclude" : false + "ConditionOccurrence" : { + "CodesetId" : 18, + "ConditionTypeExclude" : false } }, "StartWindow" : { @@ -4004,7 +4009,6 @@ }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -4024,204 +4028,7 @@ } ], "DemographicCriteriaList" : [], - "Groups" : [ - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 18, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 11, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } - ] + "Groups" : [] }, "CodesetId" : 6, "First" : true, @@ -4254,42 +4061,6 @@ } ] } - }, - { - "name" : "No other primary", - "expression" : { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "ConditionOccurrence" : { - "CodesetId" : 10, - "ConditionTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 30, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } } ], "CensoringCriteria" : [ diff --git a/inst/cohorts/114.json b/inst/cohorts/114.json index 33c9d48..6367e3e 100644 --- a/inst/cohorts/114.json +++ b/inst/cohorts/114.json @@ -4,6 +4,67 @@ "CriteriaList" : [ { "DrugExposure" : { + "CorrelatedCriteria" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 12, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 13, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + }, "CodesetId" : 11, "OccurrenceStartDate" : { "Value" : "2016-01-01", @@ -15,6 +76,67 @@ }, { "ProcedureOccurrence" : { + "CorrelatedCriteria" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 12, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 13, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + }, "CodesetId" : 4, "OccurrenceStartDate" : { "Value" : "2016-01-01", @@ -26,7 +148,103 @@ }, { "DrugExposure" : { - "CodesetId" : 13, + "CorrelatedCriteria" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 13, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [ + { + "Type" : "ANY", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 11, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "ProcedureOccurrence" : { + "CodesetId" : 4, + "ProcedureTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + ] + }, + "CodesetId" : 12, "OccurrenceStartDate" : { "Value" : "2016-01-01", "Op" : "bt", @@ -37,7 +255,103 @@ }, { "DrugExposure" : { - "CodesetId" : 15, + "CorrelatedCriteria" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 12, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [ + { + "Type" : "ANY", + "CriteriaList" : [ + { + "Criteria" : { + "DeviceExposure" : { + "CodesetId" : 11, + "DeviceTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "ProcedureOccurrence" : { + "CodesetId" : 4, + "ProcedureTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + ] + }, + "CodesetId" : 13, "OccurrenceStartDate" : { "Value" : "2016-01-01", "Op" : "bt", @@ -111,6 +425,74 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264861, + "CONCEPT_NAME" : "pM1c: Distant metastasis site other than bone or non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397215009", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264288, + "CONCEPT_NAME" : "pM1b: Distant metastasis to bone(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397214008", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4246703, + "CONCEPT_NAME" : "pM1a: Distant metastasis to non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397213002", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 763131, + "CONCEPT_NAME" : "Neoplasm of prostate distant metastasis staging category M1: Distant metastasis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "436401000124103", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false } ] } @@ -198,13 +580,47 @@ }, { "concept" : { - "CONCEPT_ID" : 4145907, - "CONCEPT_NAME" : "Orchiectomy of remaining testis", + "CONCEPT_ID" : 4304921, + "CONCEPT_NAME" : "Bilateral orchidectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "34426006", + "CONCEPT_CODE" : "386634006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4073142, + "CONCEPT_NAME" : "Bilateral total orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176416007", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4073143, + "CONCEPT_NAME" : "Bilateral total scrotal orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176418008", "DOMAIN_ID" : "Procedure", "VOCABULARY_ID" : "SNOMED", "CONCEPT_CLASS_ID" : "Procedure" @@ -230,6 +646,57 @@ "includeDescendants" : true, "includeMapped" : false }, + { + "concept" : { + "CONCEPT_ID" : 4012324, + "CONCEPT_NAME" : "Bilateral cryptorchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "112910006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4073141, + "CONCEPT_NAME" : "Bilateral subcapsular orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176415006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4071936, + "CONCEPT_NAME" : "Bilateral total inguinal orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176417003", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, { "concept" : { "CONCEPT_ID" : 35608156, @@ -521,18 +988,35 @@ }, { "concept" : { - "CONCEPT_ID" : 4012324, - "CONCEPT_NAME" : "Bilateral cryptorchidectomy", + "CONCEPT_ID" : 4341536, + "CONCEPT_NAME" : "Total orchidectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "112910006", + "CONCEPT_CODE" : "236334001", "DOMAIN_ID" : "Procedure", "VOCABULARY_ID" : "SNOMED", "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : true, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4145907, + "CONCEPT_NAME" : "Orchiectomy of remaining testis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "34426006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false } @@ -916,6 +1400,23 @@ "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4312326, + "CONCEPT_NAME" : "Neoplasm, malignant (primary)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "86049000", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Morph Abnormality" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false } ] } @@ -1185,21 +1686,21 @@ }, { "id" : 12, - "name" : "[PIONEER 2.0] Hx of prostate cancer", + "name" : "[PIONEER V2.0] ARTA", "expression" : { "items" : [ { "concept" : { - "CONCEPT_ID" : 3169330, - "CONCEPT_NAME" : "Personal history of prostate cancer", + "CONCEPT_ID" : 40239056, + "CONCEPT_NAME" : "abiraterone", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "4220001000004104", - "DOMAIN_ID" : "Observation", - "VOCABULARY_ID" : "Nebraska Lexicon", - "CONCEPT_CLASS_ID" : "Context-dependent" + "CONCEPT_CODE" : "1100072", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -1207,16 +1708,50 @@ }, { "concept" : { - "CONCEPT_ID" : 4180749, - "CONCEPT_NAME" : "History of malignant neoplasm of prostate", + "CONCEPT_ID" : 963987, + "CONCEPT_NAME" : "apalutamide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "428262008", - "DOMAIN_ID" : "Observation", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Context-dependent" + "CONCEPT_CODE" : "1999574", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 42900250, + "CONCEPT_NAME" : "enzalutamide", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "1307298", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 1361291, + "CONCEPT_NAME" : "darolutamide", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "2180325", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -1227,18 +1762,52 @@ }, { "id" : 13, - "name" : "[PIONEER V2.0] ARTA", + "name" : "[PIONEER V2.0] Chemotherapy (docetaxel & cabazitaxe & paclitaxel)", "expression" : { "items" : [ { "concept" : { - "CONCEPT_ID" : 40239056, - "CONCEPT_NAME" : "abiraterone", + "CONCEPT_ID" : 1315942, + "CONCEPT_NAME" : "docetaxel", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "72962", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 40222431, + "CONCEPT_NAME" : "cabazitaxel", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "996051", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 1378382, + "CONCEPT_NAME" : "paclitaxel", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1100072", + "CONCEPT_CODE" : "56946", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", "CONCEPT_CLASS_ID" : "Ingredient" @@ -1246,16 +1815,24 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 14, + "name" : "[PIONEER V2.0] Lutetium", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 963987, - "CONCEPT_NAME" : "apalutamide", + "CONCEPT_ID" : 44816340, + "CONCEPT_NAME" : "lutetium", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1999574", + "CONCEPT_CODE" : "1534772", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", "CONCEPT_CLASS_ID" : "Ingredient" @@ -1263,16 +1840,24 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 15, + "name" : "[PIONEER V2.0] PARP inhibitor", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 42900250, - "CONCEPT_NAME" : "enzalutamide", + "CONCEPT_ID" : 45892579, + "CONCEPT_NAME" : "olaparib", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1307298", + "CONCEPT_CODE" : "1597582", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", "CONCEPT_CLASS_ID" : "Ingredient" @@ -1283,13 +1868,13 @@ }, { "concept" : { - "CONCEPT_ID" : 1361291, - "CONCEPT_NAME" : "darolutamide", + "CONCEPT_ID" : 1718850, + "CONCEPT_NAME" : "rucaparib", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "2180325", + "CONCEPT_CODE" : "1862579", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", "CONCEPT_CLASS_ID" : "Ingredient" @@ -1302,7 +1887,7 @@ } }, { - "id" : 14, + "id" : 16, "name" : "[PIONEER V2.0] Immunotherapy (sipuleucel-T & pembrolizumab)", "expression" : { "items" : [ @@ -2942,19 +3527,19 @@ } }, { - "id" : 15, - "name" : "[PIONEER V2.0] Chemotherapy (docetaxel & cabazitaxe & paclitaxel)", + "id" : 17, + "name" : "[PIONEER V2.0] Radium-223", "expression" : { "items" : [ { "concept" : { - "CONCEPT_ID" : 1315942, - "CONCEPT_NAME" : "docetaxel", + "CONCEPT_ID" : 45775578, + "CONCEPT_NAME" : "radium", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "72962", + "CONCEPT_CODE" : "1546450", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", "CONCEPT_CLASS_ID" : "Ingredient" @@ -2965,15 +3550,15 @@ }, { "concept" : { - "CONCEPT_ID" : 40222431, - "CONCEPT_NAME" : "cabazitaxel", + "CONCEPT_ID" : 902727, + "CONCEPT_NAME" : "Radium-223", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "996051", + "CONCEPT_CODE" : "OMOP5042947", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", + "VOCABULARY_ID" : "RxNorm Extension", "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, @@ -2982,55 +3567,30 @@ }, { "concept" : { - "CONCEPT_ID" : 1378382, - "CONCEPT_NAME" : "paclitaxel", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "56946", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - } - ] - } - }, - { - "id" : 16, - "name" : "[PIONEER V2.0] PARP inhibitor", - "expression" : { - "items" : [ - { - "concept" : { - "CONCEPT_ID" : 45892579, - "CONCEPT_NAME" : "olaparib", + "CONCEPT_ID" : 41267222, + "CONCEPT_NAME" : "Radium Oral Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1597582", + "CONCEPT_CODE" : "OMOP2465184", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, - "isExcluded" : false, - "includeDescendants" : true, + "isExcluded" : true, + "includeDescendants" : false, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 1718850, - "CONCEPT_NAME" : "rucaparib", + "CONCEPT_ID" : 43526934, + "CONCEPT_NAME" : "radium chloride Ra-223", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1862579", + "CONCEPT_CODE" : "1424174", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", "CONCEPT_CLASS_ID" : "Ingredient" @@ -3043,22 +3603,22 @@ } }, { - "id" : 17, - "name" : "[PIONEER V2.0] Radium-223", + "id" : 18, + "name" : "[PIONEER 2.0] Hx of prostate cancer", "expression" : { "items" : [ { "concept" : { - "CONCEPT_ID" : 45775578, - "CONCEPT_NAME" : "radium", + "CONCEPT_ID" : 3169330, + "CONCEPT_NAME" : "Personal history of prostate cancer", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1546450", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CODE" : "4220001000004104", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "Nebraska Lexicon", + "CONCEPT_CLASS_ID" : "Context-dependent" }, "isExcluded" : false, "includeDescendants" : true, @@ -3066,148 +3626,271 @@ }, { "concept" : { - "CONCEPT_ID" : 902727, - "CONCEPT_NAME" : "Radium-223", + "CONCEPT_ID" : 4180749, + "CONCEPT_NAME" : "History of malignant neoplasm of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP5042947", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CODE" : "428262008", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Context-dependent" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + } + ], + "QualifiedLimit" : { + "Type" : "First" + }, + "ExpressionLimit" : { + "Type" : "All" + }, + "InclusionRules" : [ + { + "name" : "Male", + "expression" : { + "Type" : "ALL", + "CriteriaList" : [], + "DemographicCriteriaList" : [ { - "concept" : { - "CONCEPT_ID" : 41267222, - "CONCEPT_NAME" : "Radium Oral Solution", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP2465184", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" - }, - "isExcluded" : true, - "includeDescendants" : false, - "includeMapped" : false - }, + "Gender" : [ + { + "CONCEPT_ID" : 8507, + "CONCEPT_NAME" : "MALE", + "STANDARD_CONCEPT" : null, + "STANDARD_CONCEPT_CAPTION" : "Unknown", + "INVALID_REASON" : null, + "INVALID_REASON_CAPTION" : "Unknown", + "CONCEPT_CODE" : "M", + "DOMAIN_ID" : "Gender", + "VOCABULARY_ID" : "Gender", + "CONCEPT_CLASS_ID" : null + } + ] + } + ], + "Groups" : [] + } + }, + { + "name" : "age 18+", + "expression" : { + "Type" : "ALL", + "CriteriaList" : [], + "DemographicCriteriaList" : [ { - "concept" : { - "CONCEPT_ID" : 43526934, - "CONCEPT_NAME" : "radium chloride Ra-223", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1424174", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false + "Age" : { + "Value" : 18, + "Op" : "gte" + } } - ] + ], + "Groups" : [] } }, { - "id" : 18, - "name" : "[PIONEER V2.0] Lutetium", + "name" : "no other drugs", "expression" : { - "items" : [ + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 14, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 15, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, { - "concept" : { - "CONCEPT_ID" : 44816340, - "CONCEPT_NAME" : "lutetium", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1534772", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 16, + "DrugTypeExclude" : false + } }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - } - ] - } - } - ], - "QualifiedLimit" : { - "Type" : "First" - }, - "ExpressionLimit" : { - "Type" : "First" - }, - "InclusionRules" : [ - { - "name" : "Male", - "expression" : { - "Type" : "ALL", - "CriteriaList" : [], - "DemographicCriteriaList" : [ + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, { - "Gender" : [ - { - "CONCEPT_ID" : 8507, - "CONCEPT_NAME" : "MALE", - "STANDARD_CONCEPT" : null, - "STANDARD_CONCEPT_CAPTION" : "Unknown", - "INVALID_REASON" : null, - "INVALID_REASON_CAPTION" : "Unknown", - "CONCEPT_CODE" : "M", - "DOMAIN_ID" : "Gender", - "VOCABULARY_ID" : "Gender", - "CONCEPT_CLASS_ID" : null + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 17, + "DrugTypeExclude" : false } - ] + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } } ], + "DemographicCriteriaList" : [], "Groups" : [] } }, { - "name" : "age 18+", + "name" : "No other primary", "expression" : { "Type" : "ALL", - "CriteriaList" : [], - "DemographicCriteriaList" : [ + "CriteriaList" : [ { - "Age" : { - "Value" : 18, - "Op" : "gte" + "Criteria" : { + "ConditionOccurrence" : { + "CodesetId" : 10, + "ConditionTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "Observation" : { + "CodesetId" : 10, + "ObservationTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false } } ], + "DemographicCriteriaList" : [], "Groups" : [] } }, { - "name" : "metastasis ", + "name" : "metastasis", "expression" : { - "Type" : "ALL", + "Type" : "ANY", "CriteriaList" : [], "DemographicCriteriaList" : [], "Groups" : [ { - "Type" : "ANY", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { "ConditionOccurrence" : { "CorrelatedCriteria" : { - "Type" : "ALL", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { @@ -3217,9 +3900,9 @@ "CriteriaList" : [ { "Criteria" : { - "Observation" : { - "CodesetId" : 12, - "ObservationTypeExclude" : false + "ConditionOccurrence" : { + "CodesetId" : 18, + "ConditionTypeExclude" : false } }, "StartWindow" : { @@ -3227,7 +3910,6 @@ "Coeff" : -1 }, "End" : { - "Days" : 1, "Coeff" : -1 }, "UseIndexEnd" : false, @@ -3252,7 +3934,6 @@ }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -3272,204 +3953,7 @@ } ], "DemographicCriteriaList" : [], - "Groups" : [ - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 18, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 11, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } - ] + "Groups" : [] }, "CodesetId" : 1, "First" : true, @@ -3500,7 +3984,8 @@ "Criteria" : { "Measurement" : { "CorrelatedCriteria" : { - "Type" : "ALL", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { @@ -3510,9 +3995,9 @@ "CriteriaList" : [ { "Criteria" : { - "Observation" : { - "CodesetId" : 12, - "ObservationTypeExclude" : false + "ConditionOccurrence" : { + "CodesetId" : 18, + "ConditionTypeExclude" : false } }, "StartWindow" : { @@ -3545,7 +4030,6 @@ }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -3565,204 +4049,7 @@ } ], "DemographicCriteriaList" : [], - "Groups" : [ - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 18, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 11, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } - ] + "Groups" : [] }, "CodesetId" : 7, "First" : true, @@ -3843,7 +4130,8 @@ "Criteria" : { "Measurement" : { "CorrelatedCriteria" : { - "Type" : "ALL", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { @@ -3853,9 +4141,9 @@ "CriteriaList" : [ { "Criteria" : { - "Observation" : { - "CodesetId" : 12, - "ObservationTypeExclude" : false + "ConditionOccurrence" : { + "CodesetId" : 18, + "ConditionTypeExclude" : false } }, "StartWindow" : { @@ -3888,7 +4176,6 @@ }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -3908,204 +4195,7 @@ } ], "DemographicCriteriaList" : [], - "Groups" : [ - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 18, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 11, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } - ] + "Groups" : [] }, "CodesetId" : 6, "First" : true, @@ -4138,42 +4228,6 @@ } ] } - }, - { - "name" : "No other primary", - "expression" : { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "ConditionOccurrence" : { - "CodesetId" : 10, - "ConditionTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 30, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } } ], "CensoringCriteria" : [ diff --git a/inst/cohorts/115.json b/inst/cohorts/115.json index 6b69022..da6371c 100644 --- a/inst/cohorts/115.json +++ b/inst/cohorts/115.json @@ -4,7 +4,7 @@ "CriteriaList" : [ { "DrugExposure" : { - "CodesetId" : 13, + "CodesetId" : 11, "OccurrenceStartDate" : { "Value" : "2016-01-01", "Op" : "bt", @@ -16,7 +16,6 @@ { "ProcedureOccurrence" : { "CodesetId" : 4, - "First" : true, "OccurrenceStartDate" : { "Value" : "2016-01-01", "Op" : "bt", @@ -31,7 +30,7 @@ "PostDays" : 0 }, "PrimaryCriteriaLimit" : { - "Type" : "All" + "Type" : "First" } }, "ConceptSets" : [ @@ -90,6 +89,74 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264861, + "CONCEPT_NAME" : "pM1c: Distant metastasis site other than bone or non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397215009", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264288, + "CONCEPT_NAME" : "pM1b: Distant metastasis to bone(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397214008", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4246703, + "CONCEPT_NAME" : "pM1a: Distant metastasis to non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397213002", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 763131, + "CONCEPT_NAME" : "Neoplasm of prostate distant metastasis staging category M1: Distant metastasis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "436401000124103", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false } ] } @@ -177,13 +244,47 @@ }, { "concept" : { - "CONCEPT_ID" : 4145907, - "CONCEPT_NAME" : "Orchiectomy of remaining testis", + "CONCEPT_ID" : 4304921, + "CONCEPT_NAME" : "Bilateral orchidectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "34426006", + "CONCEPT_CODE" : "386634006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4073142, + "CONCEPT_NAME" : "Bilateral total orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176416007", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4073143, + "CONCEPT_NAME" : "Bilateral total scrotal orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176418008", "DOMAIN_ID" : "Procedure", "VOCABULARY_ID" : "SNOMED", "CONCEPT_CLASS_ID" : "Procedure" @@ -209,6 +310,57 @@ "includeDescendants" : true, "includeMapped" : false }, + { + "concept" : { + "CONCEPT_ID" : 4012324, + "CONCEPT_NAME" : "Bilateral cryptorchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "112910006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4073141, + "CONCEPT_NAME" : "Bilateral subcapsular orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176415006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4071936, + "CONCEPT_NAME" : "Bilateral total inguinal orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176417003", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, { "concept" : { "CONCEPT_ID" : 35608156, @@ -500,18 +652,35 @@ }, { "concept" : { - "CONCEPT_ID" : 4012324, - "CONCEPT_NAME" : "Bilateral cryptorchidectomy", + "CONCEPT_ID" : 4341536, + "CONCEPT_NAME" : "Total orchidectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "112910006", + "CONCEPT_CODE" : "236334001", "DOMAIN_ID" : "Procedure", "VOCABULARY_ID" : "SNOMED", "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : true, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4145907, + "CONCEPT_NAME" : "Orchiectomy of remaining testis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "34426006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false } @@ -561,7 +730,7 @@ } }, { - "id" : 9, + "id" : 7, "name" : "[PIONEER 2.0] Metastasis measurement require value", "expression" : { "items" : [ @@ -586,73 +755,73 @@ } }, { - "id" : 11, - "name" : "[Pioneer 2.0] Local trt", + "id" : 10, + "name" : "[PIONEER 2.0] other primaries", "expression" : { "items" : [ { "concept" : { - "CONCEPT_ID" : 4235738, - "CONCEPT_NAME" : "Prostatectomy", + "CONCEPT_ID" : 432851, + "CONCEPT_NAME" : "Secondary malignant neoplastic disease", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "90470006", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "128462008", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 2108677, - "CONCEPT_NAME" : "Patient counseling at a minimum on all of the following treatment options for clinically localized prostate cancer: active surveillance, and interstitial prostate brachytherapy, and external beam radiotherapy, and radical prostatectomy, provided prior to ", + "CONCEPT_ID" : 443392, + "CONCEPT_NAME" : "Malignant neoplastic disease", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "4163F", - "DOMAIN_ID" : "Observation", - "VOCABULARY_ID" : "CPT4", - "CONCEPT_CLASS_ID" : "CPT4" + "CONCEPT_CODE" : "363346000", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4216658, - "CONCEPT_NAME" : "Radical cystoprostatectomy", + "CONCEPT_ID" : 4112752, + "CONCEPT_NAME" : "Basal cell carcinoma of skin", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "81232004", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "254701007", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, - "includeDescendants" : false, + "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4306299, - "CONCEPT_NAME" : "Excision of lesion of prostate", + "CONCEPT_ID" : 4111921, + "CONCEPT_NAME" : "Squamous cell carcinoma of skin", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "83154001", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "254651007", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -660,16 +829,16 @@ }, { "concept" : { - "CONCEPT_ID" : 4338661, - "CONCEPT_NAME" : "Complete transurethral resection of prostate, including control of postoperative bleeding", + "CONCEPT_ID" : 764971, + "CONCEPT_NAME" : "Prostate cancer metastatic to eye", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "87795007", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "96901000119105", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -677,16 +846,16 @@ }, { "concept" : { - "CONCEPT_ID" : 3187777, - "CONCEPT_NAME" : "Cystoscopy with transurethral prostatectomy", + "CONCEPT_ID" : 36716186, + "CONCEPT_NAME" : "Hormone sensitive prostate cancer", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "21360001000004106", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "Nebraska Lexicon", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "722103009", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -694,16 +863,16 @@ }, { "concept" : { - "CONCEPT_ID" : 40487861, - "CONCEPT_NAME" : "Endoscopic excision of prostate using holmium laser", + "CONCEPT_ID" : 200962, + "CONCEPT_NAME" : "Primary malignant neoplasm of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "446445003", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "93974005", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -711,16 +880,16 @@ }, { "concept" : { - "CONCEPT_ID" : 4176312, - "CONCEPT_NAME" : "Endoscopic laser prostatectomy", + "CONCEPT_ID" : 36712762, + "CONCEPT_NAME" : "Recurrent malignant neoplasm of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "427985002", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "1098981000119101", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -728,16 +897,16 @@ }, { "concept" : { - "CONCEPT_ID" : 4193061, - "CONCEPT_NAME" : "Endoscopic resection of prostate using an electrotome", - "STANDARD_CONCEPT" : "S", + "CONCEPT_ID" : 37395835, + "CONCEPT_NAME" : "Familial prostate cancer", + "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "314202001", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "715412008", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -745,16 +914,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777698, - "CONCEPT_NAME" : "Excision of Prostate, Open Approach", + "CONCEPT_ID" : 4164017, + "CONCEPT_NAME" : "Squamous cell carcinoma of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB00ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "399590005", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -762,16 +931,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777697, - "CONCEPT_NAME" : "Excision of Prostate, Open Approach, Diagnostic", + "CONCEPT_ID" : 4141960, + "CONCEPT_NAME" : "Hormone refractory prostate cancer", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB00ZX", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "427492003", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -779,16 +948,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777700, - "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Approach", + "CONCEPT_ID" : 4163261, + "CONCEPT_NAME" : "Malignant tumor of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB03ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "399068003", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -796,16 +965,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777699, - "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Approach, Diagnostic", + "CONCEPT_ID" : 4183913, + "CONCEPT_NAME" : "Malignant tumor involving an organ by direct extension from prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB03ZX", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "369598006", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -813,16 +982,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777702, - "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Endoscopic Approach", + "CONCEPT_ID" : 4283614, + "CONCEPT_NAME" : "Malignant tumor involving bladder by direct extension from prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB04ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "369472002", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -830,16 +999,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777701, - "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Endoscopic Approach, Diagnostic", + "CONCEPT_ID" : 4289246, + "CONCEPT_NAME" : "Malignant tumor involving rectum by direct extension from prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB04ZX", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "369451000", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -847,16 +1016,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777704, - "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening", + "CONCEPT_ID" : 4283740, + "CONCEPT_NAME" : "Malignant tumor involving seminal vesicle by direct extension from prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB07ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "369490001", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -864,16 +1033,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777703, - "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening, Diagnostic", + "CONCEPT_ID" : 4280897, + "CONCEPT_NAME" : "Malignant tumor involving urethra by direct extension from prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB07ZX", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "369466002", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -881,16 +1050,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777706, - "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening Endoscopic", + "CONCEPT_ID" : 4289379, + "CONCEPT_NAME" : "Malignant tumor involving vasa deferentia by direct extension from prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB08ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "369483006", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -898,356 +1067,380 @@ }, { "concept" : { - "CONCEPT_ID" : 2777705, - "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening Endoscopic, Diagnostic", + "CONCEPT_ID" : 4312326, + "CONCEPT_NAME" : "Neoplasm, malignant (primary)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB08ZX", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "86049000", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Morph Abnormality" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 11, + "name" : "[PIONEER V2.0] ADT (LHRH & anti-androgen)", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 44783041, - "CONCEPT_NAME" : "Holmium laser enucleation of prostate", + "CONCEPT_ID" : 19058410, + "CONCEPT_NAME" : "degarelix", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "699075006", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "475230", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4239543, - "CONCEPT_NAME" : "One stage subtotal suprapubic prostatectomy", + "CONCEPT_ID" : 739471, + "CONCEPT_NAME" : "relugolix", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "91531008", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "2472778", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 2003966, - "CONCEPT_NAME" : "Other transurethral prostatectomy", + "CONCEPT_ID" : 35834903, + "CONCEPT_NAME" : "relugolix", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "60.29", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD9Proc", - "CONCEPT_CLASS_ID" : "4-dig billing code" + "CONCEPT_CODE" : "OMOP5040508", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4021570, - "CONCEPT_NAME" : "Radical cystoprostatourethrectomy", + "CONCEPT_ID" : 1343039, + "CONCEPT_NAME" : "triptorelin", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "176106009", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "38782", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 2780477, - "CONCEPT_NAME" : "Resection of Prostate, Open Approach", + "CONCEPT_ID" : 19089810, + "CONCEPT_NAME" : "gonadorelin", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VT00ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "6384", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 2780478, - "CONCEPT_NAME" : "Resection of Prostate, Percutaneous Endoscopic Approach", + "CONCEPT_ID" : 1366310, + "CONCEPT_NAME" : "goserelin", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VT04ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "50610", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 2780479, - "CONCEPT_NAME" : "Resection of Prostate, Via Natural or Artificial Opening", + "CONCEPT_ID" : 1351541, + "CONCEPT_NAME" : "leuprolide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VT07ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "42375", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 2780480, - "CONCEPT_NAME" : "Resection of Prostate, Via Natural or Artificial Opening Endoscopic", + "CONCEPT_ID" : 1344381, + "CONCEPT_NAME" : "bicalutamide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VT08ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "83008", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4341384, - "CONCEPT_NAME" : "Salvage cystoprostatectomy", + "CONCEPT_ID" : 19010792, + "CONCEPT_NAME" : "cyproterone", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "236211007", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "3014", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4341893, - "CONCEPT_NAME" : "Salvage cystoprostatourethrectomy", + "CONCEPT_ID" : 1356461, + "CONCEPT_NAME" : "flutamide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "236209003", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "4508", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4212360, - "CONCEPT_NAME" : "Subtotal perineal prostatectomy", + "CONCEPT_ID" : 1500211, + "CONCEPT_NAME" : "medroxyprogesterone", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "57525009", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "6691", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4147673, - "CONCEPT_NAME" : "Subtotal prostatectomy", + "CONCEPT_ID" : 1300978, + "CONCEPT_NAME" : "megestrol", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "30426000", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "6703", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4078386, - "CONCEPT_NAME" : "Subtotal retropubic prostatectomy", + "CONCEPT_ID" : 1315286, + "CONCEPT_NAME" : "nilutamide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "19149007", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "31805", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4073700, - "CONCEPT_NAME" : "Transurethral laser prostatectomy", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", + "CONCEPT_ID" : 35807385, + "CONCEPT_NAME" : "GnRH agonist", + "STANDARD_CONCEPT" : "C", + "STANDARD_CONCEPT_CAPTION" : "Classification", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "176288003", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "45768", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "HemOnc", + "CONCEPT_CLASS_ID" : "Component Class" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4234536, - "CONCEPT_NAME" : "Transurethral prostatectomy", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", + "CONCEPT_ID" : 35807349, + "CONCEPT_NAME" : "GnRH antagonist", + "STANDARD_CONCEPT" : "C", + "STANDARD_CONCEPT_CAPTION" : "Classification", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "90199006", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "45632", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "HemOnc", + "CONCEPT_CLASS_ID" : "Component Class" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 12, + "name" : "[PIONEER V2.0] ARTA", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 4287859, - "CONCEPT_NAME" : "Transurethral resection of prostate, first stage of two stages", + "CONCEPT_ID" : 40239056, + "CONCEPT_NAME" : "abiraterone", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "68986004", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "1100072", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44783043, - "CONCEPT_NAME" : "Transurethral thulium laser enucleation of prostate", + "CONCEPT_ID" : 963987, + "CONCEPT_NAME" : "apalutamide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "699077003", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "1999574", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4071791, - "CONCEPT_NAME" : "Transvesical two stage prostatectomy", + "CONCEPT_ID" : 42900250, + "CONCEPT_NAME" : "enzalutamide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "176260009", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "1307298", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4054558, - "CONCEPT_NAME" : "Two stage subtotal suprapubic prostatectomy", + "CONCEPT_ID" : 1361291, + "CONCEPT_NAME" : "darolutamide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "21190008", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "2180325", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 13, + "name" : "[PIONEER V2.0] Chemotherapy (docetaxel & cabazitaxe & paclitaxel)", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 4330932, - "CONCEPT_NAME" : "CT of prostate for radiotherapy planning", + "CONCEPT_ID" : 1315942, + "CONCEPT_NAME" : "docetaxel", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "429856001", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "72962", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -1255,16 +1448,16 @@ }, { "concept" : { - "CONCEPT_ID" : 37396025, - "CONCEPT_NAME" : "CT of prostate with contrast for radiotherapy planning", + "CONCEPT_ID" : 40222431, + "CONCEPT_NAME" : "cabazitaxel", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "715687002", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "996051", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -1272,50 +1465,66 @@ }, { "concept" : { - "CONCEPT_ID" : 2108724, - "CONCEPT_NAME" : "External beam radiotherapy as primary therapy to prostate with or without nodal irradiation (PRCA)", + "CONCEPT_ID" : 1378382, + "CONCEPT_NAME" : "paclitaxel", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "4200F", - "DOMAIN_ID" : "Observation", - "VOCABULARY_ID" : "CPT4", - "CONCEPT_CLASS_ID" : "CPT4" + "CONCEPT_CODE" : "56946", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 14, + "name" : "[PIONEER V2.0] Lutetium", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 2108725, - "CONCEPT_NAME" : "External beam radiotherapy with or without nodal irradiation as adjuvant or salvage therapy for prostate cancer patient (PRCA)", + "CONCEPT_ID" : 44816340, + "CONCEPT_NAME" : "lutetium", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "4201F", - "DOMAIN_ID" : "Observation", - "VOCABULARY_ID" : "CPT4", - "CONCEPT_CLASS_ID" : "CPT4" + "CONCEPT_CODE" : "1534772", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 15, + "name" : "[PIONEER V2.0] PARP inhibitor", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 4198015, - "CONCEPT_NAME" : "MRI of prostate for radiotherapy planning", + "CONCEPT_ID" : 45892579, + "CONCEPT_NAME" : "olaparib", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "431850000", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "1597582", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -1323,33 +1532,41 @@ }, { "concept" : { - "CONCEPT_ID" : 43533205, - "CONCEPT_NAME" : "Low dose rate (ldr) prostate brachytherapy services, composite rate", + "CONCEPT_ID" : 1718850, + "CONCEPT_NAME" : "rucaparib", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "G0458", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "HCPCS", - "CONCEPT_CLASS_ID" : "HCPCS" + "CONCEPT_CODE" : "1862579", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 16, + "name" : "[PIONEER V2.0] Immunotherapy (sipuleucel-T & pembrolizumab)", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 2790073, - "CONCEPT_NAME" : "Contact Radiation of Prostate", + "CONCEPT_ID" : 586622, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DVY07ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP3138293", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -1357,16 +1574,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1781260, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Cesium 131 (Cs-131)", + "CONCEPT_ID" : 587503, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10B6Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP3136350", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Clinical Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -1374,16 +1591,16 @@ }, { "concept" : { - "CONCEPT_ID" : 4041984, - "CONCEPT_NAME" : "Laser ablation of prostate", + "CONCEPT_ID" : 784328, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] Box of 1 by MSD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "118164001", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "OMOP4832151", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1391,16 +1608,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789856, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Other Isotope", + "CONCEPT_ID" : 1830614, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Abacus Medicine", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10BYZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP5155867", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1408,16 +1625,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1524039, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Palladium 103 (Pd-103), Unidirectional Source", + "CONCEPT_ID" : 1832328, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by Abacus Medicine", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10BB1", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP5157569", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1425,16 +1642,16 @@ }, { "concept" : { - "CONCEPT_ID" : 37111533, - "CONCEPT_NAME" : "Ultrasonography guided transrectal cryoablation of prostate", + "CONCEPT_ID" : 21021970, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] Box of 1 by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "726544002", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "OMOP344279", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1442,16 +1659,16 @@ }, { "concept" : { - "CONCEPT_ID" : 4061656, - "CONCEPT_NAME" : "Microwave therapy to prostate", + "CONCEPT_ID" : 21090575, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "169429005", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "OMOP344278", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -1459,16 +1676,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789850, - "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Other Isotope", + "CONCEPT_ID" : 21120047, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV109YZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP344275", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -1476,16 +1693,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789851, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Cesium 137 (Cs-137)", + "CONCEPT_ID" : 21159533, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10B7Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP344277", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1493,16 +1710,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789848, - "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Palladium 103 (Pd-103)", + "CONCEPT_ID" : 35129163, + "CONCEPT_NAME" : "0.8 ML pembrolizumab 25 MG/ML Injectable Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV109BZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP4786432", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -1510,16 +1727,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789849, - "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Californium 252 (Cf-252)", + "CONCEPT_ID" : 35139888, + "CONCEPT_NAME" : "0.8 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV109CZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP4797037", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -1527,16 +1744,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789854, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Palladium 103 (Pd-103)", + "CONCEPT_ID" : 35604048, + "CONCEPT_NAME" : "sipuleucel-T Injection", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10BBZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "1726181", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -1544,16 +1761,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789855, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Californium 252 (Cf-252)", + "CONCEPT_ID" : 35604049, + "CONCEPT_NAME" : "sipuleucel-T Injection [Provenge]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10BCZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "1726183", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -1561,16 +1778,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789852, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Iridium 192 (Ir-192)", + "CONCEPT_ID" : 35604050, + "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML Injection", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10B8Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "1726185", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -1578,16 +1795,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789853, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Iodine 125 (I-125)", + "CONCEPT_ID" : 35604051, + "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML Injection [Provenge]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10B9Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "1726186", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -1595,16 +1812,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789846, - "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Iridium 192 (Ir-192)", + "CONCEPT_ID" : 35803678, + "CONCEPT_NAME" : "Pembrolizumab monotherapy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV1098Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "3199", + "DOMAIN_ID" : "Regimen", + "VOCABULARY_ID" : "HemOnc", + "CONCEPT_CLASS_ID" : "Regimen" }, "isExcluded" : false, "includeDescendants" : true, @@ -1612,16 +1829,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789847, - "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Iodine 125 (I-125)", + "CONCEPT_ID" : 36056039, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] Box of 1 by Originalis B.V.", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV1099Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP4981443", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1629,16 +1846,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789845, - "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Cesium 137 (Cs-137)", + "CONCEPT_ID" : 36056040, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by Originalis B.V.", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV1097Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP4981444", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1646,16 +1863,16 @@ }, { "concept" : { - "CONCEPT_ID" : 759648, - "CONCEPT_NAME" : "Ablation of malignant prostate tissue, transrectal, with high intensity-focused ultrasound (HIFU), including ultrasound guidance", + "CONCEPT_ID" : 36065121, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] Box of 1 by Originalis B.V.", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "55880", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "CPT4", - "CONCEPT_CLASS_ID" : "CPT4" + "CONCEPT_CODE" : "OMOP4991393", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1663,16 +1880,16 @@ }, { "concept" : { - "CONCEPT_ID" : 4073126, - "CONCEPT_NAME" : "Cryotherapy to prostate via perineal probe", + "CONCEPT_ID" : 36065122, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Originalis B.V.", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "176319004", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "OMOP4991394", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1680,16 +1897,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2110047, - "CONCEPT_NAME" : "Transperineal placement of needles or catheters into prostate for interstitial radioelement application, with or without cystoscopy", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", + "CONCEPT_ID" : 36224401, + "CONCEPT_NAME" : "sipuleucel-T Injectable Product", + "STANDARD_CONCEPT" : "C", + "STANDARD_CONCEPT_CAPTION" : "Classification", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "55875", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "CPT4", - "CONCEPT_CLASS_ID" : "CPT4" + "CONCEPT_CODE" : "1159660", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Dose Group" }, "isExcluded" : false, "includeDescendants" : true, @@ -1697,58 +1914,50 @@ }, { "concept" : { - "CONCEPT_ID" : 37111533, - "CONCEPT_NAME" : "Ultrasonography guided transrectal cryoablation of prostate", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", + "CONCEPT_ID" : 36238934, + "CONCEPT_NAME" : "Provenge Injectable Product", + "STANDARD_CONCEPT" : "C", + "STANDARD_CONCEPT_CAPTION" : "Classification", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "726544002", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "1182470", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Dose Group" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 12, - "name" : "[PIONEER 2.0] other primaries", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 432851, - "CONCEPT_NAME" : "Secondary malignant neoplastic disease", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", + "CONCEPT_ID" : 36247443, + "CONCEPT_NAME" : "pembrolizumab Injectable Product", + "STANDARD_CONCEPT" : "C", + "STANDARD_CONCEPT_CAPTION" : "Classification", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "128462008", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "1547547", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Dose Group" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 443392, - "CONCEPT_NAME" : "Malignant neoplastic disease", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", + "CONCEPT_ID" : 36247444, + "CONCEPT_NAME" : "Keytruda Injectable Product", + "STANDARD_CONCEPT" : "C", + "STANDARD_CONCEPT_CAPTION" : "Classification", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "363346000", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "1547553", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Dose Group" }, "isExcluded" : false, "includeDescendants" : true, @@ -1756,296 +1965,288 @@ }, { "concept" : { - "CONCEPT_ID" : 4112752, - "CONCEPT_NAME" : "Basal cell carcinoma of skin", + "CONCEPT_ID" : 36271591, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] by MSD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "254701007", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP3122466", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4111921, - "CONCEPT_NAME" : "Squamous cell carcinoma of skin", + "CONCEPT_ID" : 36278763, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda] by MSD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "254651007", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP3129638", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 764971, - "CONCEPT_NAME" : "Prostate cancer metastatic to eye", + "CONCEPT_ID" : 36404396, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "96901000119105", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP3096438", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36716186, - "CONCEPT_NAME" : "Hormone sensitive prostate cancer", + "CONCEPT_ID" : 36405170, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "722103009", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP3097212", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 200962, - "CONCEPT_NAME" : "Primary malignant neoplasm of prostate", + "CONCEPT_ID" : 36780945, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution [Keytruda] Box of 1 by MSD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "93974005", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4769239", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36712762, - "CONCEPT_NAME" : "Recurrent malignant neoplasm of prostate", + "CONCEPT_ID" : 36780946, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1098981000119101", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4769240", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Branded Box" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 37395835, - "CONCEPT_NAME" : "Familial prostate cancer", + "CONCEPT_ID" : 36780947, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "715412008", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4769241", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Branded Drug" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4164017, - "CONCEPT_NAME" : "Squamous cell carcinoma of prostate", + "CONCEPT_ID" : 36780948, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "399590005", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4769242", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Clinical Box" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4141960, - "CONCEPT_NAME" : "Hormone refractory prostate cancer", + "CONCEPT_ID" : 36780949, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "427492003", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4769243", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Clinical Drug" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4163261, - "CONCEPT_NAME" : "Malignant tumor of prostate", + "CONCEPT_ID" : 36787995, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "399068003", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776257", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4183913, - "CONCEPT_NAME" : "Malignant tumor involving an organ by direct extension from prostate", + "CONCEPT_ID" : 36787996, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "369598006", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776258", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4283614, - "CONCEPT_NAME" : "Malignant tumor involving bladder by direct extension from prostate", + "CONCEPT_ID" : 36787997, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "369472002", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776259", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4289246, - "CONCEPT_NAME" : "Malignant tumor involving rectum by direct extension from prostate", + "CONCEPT_ID" : 36787998, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "369451000", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776260", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4283740, - "CONCEPT_NAME" : "Malignant tumor involving seminal vesicle by direct extension from prostate", + "CONCEPT_ID" : 36787999, + "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution [Keytruda] Box of 1 by MSD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "369490001", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776261", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4280897, - "CONCEPT_NAME" : "Malignant tumor involving urethra by direct extension from prostate", + "CONCEPT_ID" : 36788000, + "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "369466002", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776262", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4289379, - "CONCEPT_NAME" : "Malignant tumor involving vasa deferentia by direct extension from prostate", + "CONCEPT_ID" : 36788001, + "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "369483006", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776263", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 13, - "name" : "[PIONEER V2.0] ADT (LHRH & anti-androgen)", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 19058410, - "CONCEPT_NAME" : "degarelix", + "CONCEPT_ID" : 36788002, + "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "475230", + "CONCEPT_CODE" : "OMOP4776264", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2053,16 +2254,16 @@ }, { "concept" : { - "CONCEPT_ID" : 739471, - "CONCEPT_NAME" : "relugolix", + "CONCEPT_ID" : 36788003, + "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "2472778", + "CONCEPT_CODE" : "OMOP4776265", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2070,16 +2271,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35834903, - "CONCEPT_NAME" : "relugolix", + "CONCEPT_ID" : 36788004, + "CONCEPT_NAME" : "pembrolizumab Intravenous Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP5040508", + "CONCEPT_CODE" : "OMOP4776266", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CLASS_ID" : "Branded Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2087,16 +2288,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1343039, - "CONCEPT_NAME" : "triptorelin", + "CONCEPT_ID" : 36788005, + "CONCEPT_NAME" : "pembrolizumab Intravenous Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "38782", + "CONCEPT_CODE" : "OMOP4776267", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2104,16 +2305,16 @@ }, { "concept" : { - "CONCEPT_ID" : 19089810, - "CONCEPT_NAME" : "gonadorelin", + "CONCEPT_ID" : 36879366, + "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "6384", + "CONCEPT_CODE" : "OMOP995343", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2121,16 +2322,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1366310, - "CONCEPT_NAME" : "goserelin", + "CONCEPT_ID" : 36880201, + "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "50610", + "CONCEPT_CODE" : "OMOP1005850", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2138,16 +2339,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1351541, - "CONCEPT_NAME" : "leuprolide", + "CONCEPT_ID" : 36885115, + "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "42375", + "CONCEPT_CODE" : "OMOP989456", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2155,16 +2356,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1344381, - "CONCEPT_NAME" : "bicalutamide", + "CONCEPT_ID" : 36889553, + "CONCEPT_NAME" : "pembrolizumab Prefilled Syringe", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "83008", + "CONCEPT_CODE" : "OMOP998887", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2172,16 +2373,16 @@ }, { "concept" : { - "CONCEPT_ID" : 19010792, - "CONCEPT_NAME" : "cyproterone", + "CONCEPT_ID" : 36889599, + "CONCEPT_NAME" : "pembrolizumab Prefilled Syringe [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "3014", + "CONCEPT_CODE" : "OMOP1005312", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2189,16 +2390,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1356461, - "CONCEPT_NAME" : "flutamide", + "CONCEPT_ID" : 36892847, + "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "4508", + "CONCEPT_CODE" : "OMOP991291", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2206,16 +2407,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1500211, - "CONCEPT_NAME" : "medroxyprogesterone", + "CONCEPT_ID" : 37592548, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] by HVD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "6691", + "CONCEPT_CODE" : "OMOP4781994", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -2223,16 +2424,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1300978, - "CONCEPT_NAME" : "megestrol", + "CONCEPT_ID" : 40224085, + "CONCEPT_NAME" : "250 ML sipuleucel-T 200000 CELLS/ML Injection [Provenge]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "6703", + "CONCEPT_CODE" : "997267", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CLASS_ID" : "Quant Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2240,16 +2441,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1315286, - "CONCEPT_NAME" : "nilutamide", + "CONCEPT_ID" : 40224086, + "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML [Provenge]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "31805", + "CONCEPT_CODE" : "997265", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CLASS_ID" : "Branded Drug Comp" }, "isExcluded" : false, "includeDescendants" : true, @@ -2257,16 +2458,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35807385, - "CONCEPT_NAME" : "GnRH agonist", - "STANDARD_CONCEPT" : "C", - "STANDARD_CONCEPT_CAPTION" : "Classification", + "CONCEPT_ID" : 40224095, + "CONCEPT_NAME" : "sipuleucel-T", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "45768", + "CONCEPT_CODE" : "997261", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "HemOnc", - "CONCEPT_CLASS_ID" : "Component Class" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -2274,41 +2475,33 @@ }, { "concept" : { - "CONCEPT_ID" : 35807349, - "CONCEPT_NAME" : "GnRH antagonist", - "STANDARD_CONCEPT" : "C", - "STANDARD_CONCEPT_CAPTION" : "Classification", + "CONCEPT_ID" : 40224096, + "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "45632", + "CONCEPT_CODE" : "997262", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "HemOnc", - "CONCEPT_CLASS_ID" : "Component Class" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Drug Comp" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 14, - "name" : "[PIONEER V2.0] ARTA", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 40239056, - "CONCEPT_NAME" : "abiraterone", + "CONCEPT_ID" : 40224097, + "CONCEPT_NAME" : "250 ML sipuleucel-T 200000 CELLS/ML Injection", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1100072", + "CONCEPT_CODE" : "997264", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CLASS_ID" : "Quant Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2316,16 +2509,16 @@ }, { "concept" : { - "CONCEPT_ID" : 963987, - "CONCEPT_NAME" : "apalutamide", + "CONCEPT_ID" : 40716385, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1999574", + "CONCEPT_CODE" : "OMOP4740730", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -2333,16 +2526,16 @@ }, { "concept" : { - "CONCEPT_ID" : 42900250, - "CONCEPT_NAME" : "enzalutamide", + "CONCEPT_ID" : 40745552, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] Box of 1 by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1307298", + "CONCEPT_CODE" : "OMOP4711640", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -2350,41 +2543,33 @@ }, { "concept" : { - "CONCEPT_ID" : 1361291, - "CONCEPT_NAME" : "darolutamide", + "CONCEPT_ID" : 40745553, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "2180325", + "CONCEPT_CODE" : "OMOP4711639", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 15, - "name" : "[PIONEER V2.0] Chemotherapy (docetaxel & cabazitaxe & paclitaxel)", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 1315942, - "CONCEPT_NAME" : "docetaxel", + "CONCEPT_ID" : 40745554, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "72962", + "CONCEPT_CODE" : "OMOP4711638", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -2392,16 +2577,16 @@ }, { "concept" : { - "CONCEPT_ID" : 40222431, - "CONCEPT_NAME" : "cabazitaxel", + "CONCEPT_ID" : 40745555, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "996051", + "CONCEPT_CODE" : "OMOP4711637", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2409,66 +2594,50 @@ }, { "concept" : { - "CONCEPT_ID" : 1378382, - "CONCEPT_NAME" : "paclitaxel", + "CONCEPT_ID" : 41079944, + "CONCEPT_NAME" : "sipuleucel-T Injectable Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "56946", + "CONCEPT_CODE" : "OMOP2277906", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 16, - "name" : "[PIONEER V2.0] Lutetium", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 44816340, - "CONCEPT_NAME" : "lutetium", + "CONCEPT_ID" : 41122672, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1534772", + "CONCEPT_CODE" : "OMOP2320634", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 17, - "name" : "[PIONEER V2.0] PARP inhibitor", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 45892579, - "CONCEPT_NAME" : "olaparib", + "CONCEPT_ID" : 41133743, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] Box of 1 by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1597582", + "CONCEPT_CODE" : "OMOP2331705", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -2476,41 +2645,33 @@ }, { "concept" : { - "CONCEPT_ID" : 1718850, - "CONCEPT_NAME" : "rucaparib", + "CONCEPT_ID" : 41271431, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1862579", + "CONCEPT_CODE" : "OMOP2469393", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 18, - "name" : "[PIONEER V2.0] Immunotherapy (sipuleucel-T & pembrolizumab)", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 586622, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection Box of 1", + "CONCEPT_ID" : 42658251, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by MSD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3138293", + "CONCEPT_CODE" : "OMOP4869815", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -2518,16 +2679,16 @@ }, { "concept" : { - "CONCEPT_ID" : 587503, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection Box of 1", + "CONCEPT_ID" : 42921578, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3136350", + "CONCEPT_CODE" : "OMOP4648403", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Clinical Box" + "CONCEPT_CLASS_ID" : "Quant Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2535,16 +2696,16 @@ }, { "concept" : { - "CONCEPT_ID" : 784328, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] Box of 1 by MSD", + "CONCEPT_ID" : 42963145, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injectable Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4832151", + "CONCEPT_CODE" : "OMOP4689628", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2552,16 +2713,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1830614, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Abacus Medicine", + "CONCEPT_ID" : 42963146, + "CONCEPT_NAME" : "pembrolizumab Injectable Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP5155867", + "CONCEPT_CODE" : "OMOP4689629", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CLASS_ID" : "Branded Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2569,13 +2730,13 @@ }, { "concept" : { - "CONCEPT_ID" : 1832328, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by Abacus Medicine", + "CONCEPT_ID" : 43173544, + "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe [Keytruda] Box of 1 by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP5157569", + "CONCEPT_CODE" : "OMOP496837", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", "CONCEPT_CLASS_ID" : "Marketed Product" @@ -2586,13 +2747,13 @@ }, { "concept" : { - "CONCEPT_ID" : 21021970, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] Box of 1 by Merck", + "CONCEPT_ID" : 44075484, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP344279", + "CONCEPT_CODE" : "OMOP1070115", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", "CONCEPT_CLASS_ID" : "Marketed Product" @@ -2603,16 +2764,16 @@ }, { "concept" : { - "CONCEPT_ID" : 21090575, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] Box of 1", + "CONCEPT_ID" : 44081458, + "CONCEPT_NAME" : "pembrolizumab Injectable Suspension", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP344278", + "CONCEPT_CODE" : "OMOP1076089", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2620,16 +2781,16 @@ }, { "concept" : { - "CONCEPT_ID" : 21120047, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection Box of 1", + "CONCEPT_ID" : 44082527, + "CONCEPT_NAME" : "pembrolizumab Injectable Suspension [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP344275", + "CONCEPT_CODE" : "OMOP1077158", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "CONCEPT_CLASS_ID" : "Branded Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2637,16 +2798,16 @@ }, { "concept" : { - "CONCEPT_ID" : 21159533, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] by Merck", + "CONCEPT_ID" : 44084103, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP344277", + "CONCEPT_CODE" : "OMOP1078734", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2654,16 +2815,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35129163, - "CONCEPT_NAME" : "0.8 ML pembrolizumab 25 MG/ML Injectable Solution", + "CONCEPT_ID" : 44124784, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4786432", + "CONCEPT_CODE" : "OMOP1119415", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Clinical Drug" + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2671,16 +2832,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35139888, - "CONCEPT_NAME" : "0.8 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda]", + "CONCEPT_ID" : 44164861, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injectable Solution Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4797037", + "CONCEPT_CODE" : "OMOP3041584", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Branded Drug" + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2688,16 +2849,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35604048, - "CONCEPT_NAME" : "sipuleucel-T Injection", + "CONCEPT_ID" : 44164862, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injectable Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1726181", + "CONCEPT_CODE" : "OMOP3041585", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2705,16 +2866,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35604049, - "CONCEPT_NAME" : "sipuleucel-T Injection [Provenge]", + "CONCEPT_ID" : 44175744, + "CONCEPT_NAME" : "pembrolizumab Injectable Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1726183", + "CONCEPT_CODE" : "OMOP3052467", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug Form" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2722,16 +2883,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35604050, - "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML Injection", + "CONCEPT_ID" : 44184353, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1726185", + "CONCEPT_CODE" : "OMOP3061076", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2739,16 +2900,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35604051, - "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML Injection [Provenge]", + "CONCEPT_ID" : 44191541, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1726186", + "CONCEPT_CODE" : "OMOP3068264", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Branded Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2756,16 +2917,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35803678, - "CONCEPT_NAME" : "Pembrolizumab monotherapy", + "CONCEPT_ID" : 44191562, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "3199", - "DOMAIN_ID" : "Regimen", - "VOCABULARY_ID" : "HemOnc", - "CONCEPT_CLASS_ID" : "Regimen" + "CONCEPT_CODE" : "OMOP3068285", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2773,16 +2934,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36056039, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] Box of 1 by Originalis B.V.", + "CONCEPT_ID" : 44191588, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4981443", + "CONCEPT_CODE" : "OMOP3068311", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CLASS_ID" : "Quant Clinical Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2790,13 +2951,13 @@ }, { "concept" : { - "CONCEPT_ID" : 36056040, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by Originalis B.V.", + "CONCEPT_ID" : 44191599, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda] Box of 1 by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4981444", + "CONCEPT_CODE" : "OMOP3068322", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", "CONCEPT_CLASS_ID" : "Marketed Product" @@ -2807,16 +2968,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36065121, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] Box of 1 by Originalis B.V.", - "STANDARD_CONCEPT" : "S", + "CONCEPT_ID" : 45775965, + "CONCEPT_NAME" : "pembrolizumab", + "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4991393", + "CONCEPT_CODE" : "1547545", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -2824,16 +2985,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36065122, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Originalis B.V.", + "CONCEPT_ID" : 45775966, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4991394", + "CONCEPT_CODE" : "1547546", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Drug Comp" }, "isExcluded" : false, "includeDescendants" : true, @@ -2841,16 +3002,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36224401, - "CONCEPT_NAME" : "sipuleucel-T Injectable Product", - "STANDARD_CONCEPT" : "C", - "STANDARD_CONCEPT_CAPTION" : "Classification", + "CONCEPT_ID" : 45775970, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML [Keytruda]", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1159660", + "CONCEPT_CODE" : "1547551", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Dose Group" + "CONCEPT_CLASS_ID" : "Branded Drug Comp" }, "isExcluded" : false, "includeDescendants" : true, @@ -2858,16 +3019,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36238934, - "CONCEPT_NAME" : "Provenge Injectable Product", - "STANDARD_CONCEPT" : "C", - "STANDARD_CONCEPT_CAPTION" : "Classification", + "CONCEPT_ID" : 46276407, + "CONCEPT_NAME" : "pembrolizumab 50 MG", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1182470", + "CONCEPT_CODE" : "1657744", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Dose Group" + "CONCEPT_CLASS_ID" : "Clinical Drug Comp" }, "isExcluded" : false, "includeDescendants" : true, @@ -2875,16 +3036,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36247443, - "CONCEPT_NAME" : "pembrolizumab Injectable Product", - "STANDARD_CONCEPT" : "C", - "STANDARD_CONCEPT_CAPTION" : "Classification", + "CONCEPT_ID" : 46276408, + "CONCEPT_NAME" : "pembrolizumab Injection", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1547547", + "CONCEPT_CODE" : "1657745", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Dose Group" + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2892,16 +3053,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36247444, - "CONCEPT_NAME" : "Keytruda Injectable Product", - "STANDARD_CONCEPT" : "C", - "STANDARD_CONCEPT_CAPTION" : "Classification", + "CONCEPT_ID" : 46276409, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1547553", + "CONCEPT_CODE" : "1657746", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Dose Group" + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2909,16 +3070,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36271591, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] by MSD", + "CONCEPT_ID" : 46276410, + "CONCEPT_NAME" : "pembrolizumab 50 MG [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3122466", + "CONCEPT_CODE" : "1657747", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Drug Comp" }, "isExcluded" : false, "includeDescendants" : true, @@ -2926,16 +3087,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36278763, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda] by MSD", + "CONCEPT_ID" : 46276411, + "CONCEPT_NAME" : "pembrolizumab Injection [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3129638", + "CONCEPT_CODE" : "1657748", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2943,16 +3104,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36404396, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution Box of 1", + "CONCEPT_ID" : 46276412, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3096438", + "CONCEPT_CODE" : "1657749", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2960,16 +3121,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36405170, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution", + "CONCEPT_ID" : 46276413, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3097212", + "CONCEPT_CODE" : "1657750", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Quant Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2977,16 +3138,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36780945, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution [Keytruda] Box of 1 by MSD", + "CONCEPT_ID" : 46276414, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4769239", + "CONCEPT_CODE" : "1657751", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Quant Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2994,16 +3155,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36780946, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution [Keytruda] Box of 1", + "CONCEPT_ID" : 46276415, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4769240", + "CONCEPT_CODE" : "1657752", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Branded Box" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -3011,33 +3172,41 @@ }, { "concept" : { - "CONCEPT_ID" : 36780947, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution [Keytruda]", + "CONCEPT_ID" : 46276416, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4769241", + "CONCEPT_CODE" : "1657753", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Branded Drug" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 17, + "name" : "[PIONEER V2.0] Radium-223", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 36780948, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution Box of 1", + "CONCEPT_ID" : 45775578, + "CONCEPT_NAME" : "radium", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4769242", + "CONCEPT_CODE" : "1546450", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Clinical Box" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -3045,16 +3214,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36780949, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution", + "CONCEPT_ID" : 902727, + "CONCEPT_NAME" : "Radium-223", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4769243", + "CONCEPT_CODE" : "OMOP5042947", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Clinical Drug" + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -3062,50 +3231,58 @@ }, { "concept" : { - "CONCEPT_ID" : 36787995, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution [Keytruda] Box of 1", + "CONCEPT_ID" : 41267222, + "CONCEPT_NAME" : "Radium Oral Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776257", + "CONCEPT_CODE" : "OMOP2465184", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, - "isExcluded" : false, - "includeDescendants" : true, + "isExcluded" : true, + "includeDescendants" : false, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36787996, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution [Keytruda]", + "CONCEPT_ID" : 43526934, + "CONCEPT_NAME" : "radium chloride Ra-223", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776258", + "CONCEPT_CODE" : "1424174", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 18, + "name" : "[PIONEER 2.0] Hx of prostate cancer", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 36787997, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution Box of 1", + "CONCEPT_ID" : 3169330, + "CONCEPT_NAME" : "Personal history of prostate cancer", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776259", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "CONCEPT_CODE" : "4220001000004104", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "Nebraska Lexicon", + "CONCEPT_CLASS_ID" : "Context-dependent" }, "isExcluded" : false, "includeDescendants" : true, @@ -3113,33 +3290,41 @@ }, { "concept" : { - "CONCEPT_ID" : 36787998, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution", + "CONCEPT_ID" : 4180749, + "CONCEPT_NAME" : "History of malignant neoplasm of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776260", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "428262008", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Context-dependent" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 19, + "name" : "[Pioneer 2.0] Local trt", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 36787999, - "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution [Keytruda] Box of 1 by MSD", + "CONCEPT_ID" : 4235738, + "CONCEPT_NAME" : "Prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776261", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "90470006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -3147,645 +3332,645 @@ }, { "concept" : { - "CONCEPT_ID" : 36788000, - "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution [Keytruda] Box of 1", + "CONCEPT_ID" : 2108677, + "CONCEPT_NAME" : "Patient counseling at a minimum on all of the following treatment options for clinically localized prostate cancer: active surveillance, and interstitial prostate brachytherapy, and external beam radiotherapy, and radical prostatectomy, provided prior to ", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776262", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CODE" : "4163F", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36788001, - "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution [Keytruda]", + "CONCEPT_ID" : 4216658, + "CONCEPT_NAME" : "Radical cystoprostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776263", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "81232004", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, - "includeDescendants" : true, + "isExcluded" : true, + "includeDescendants" : false, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36788002, - "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution Box of 1", + "CONCEPT_ID" : 4306299, + "CONCEPT_NAME" : "Excision of lesion of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776264", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "CONCEPT_CODE" : "83154001", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36788003, - "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution", + "CONCEPT_ID" : 4338661, + "CONCEPT_NAME" : "Complete transurethral resection of prostate, including control of postoperative bleeding", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776265", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "87795007", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36788004, - "CONCEPT_NAME" : "pembrolizumab Intravenous Solution [Keytruda]", + "CONCEPT_ID" : 3187777, + "CONCEPT_NAME" : "Cystoscopy with transurethral prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776266", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Form" + "CONCEPT_CODE" : "21360001000004106", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "Nebraska Lexicon", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36788005, - "CONCEPT_NAME" : "pembrolizumab Intravenous Solution", + "CONCEPT_ID" : 40487861, + "CONCEPT_NAME" : "Endoscopic excision of prostate using holmium laser", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776267", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "446445003", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36879366, - "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe [Keytruda]", + "CONCEPT_ID" : 4176312, + "CONCEPT_NAME" : "Endoscopic laser prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP995343", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "427985002", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36880201, - "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe Box of 1", + "CONCEPT_ID" : 4193061, + "CONCEPT_NAME" : "Endoscopic resection of prostate using an electrotome", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1005850", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "CONCEPT_CODE" : "314202001", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36885115, - "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe [Keytruda] Box of 1", + "CONCEPT_ID" : 2777698, + "CONCEPT_NAME" : "Excision of Prostate, Open Approach", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP989456", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CODE" : "0VB00ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36889553, - "CONCEPT_NAME" : "pembrolizumab Prefilled Syringe", + "CONCEPT_ID" : 2777697, + "CONCEPT_NAME" : "Excision of Prostate, Open Approach, Diagnostic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP998887", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "0VB00ZX", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36889599, - "CONCEPT_NAME" : "pembrolizumab Prefilled Syringe [Keytruda]", + "CONCEPT_ID" : 2777700, + "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Approach", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1005312", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Form" + "CONCEPT_CODE" : "0VB03ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36892847, - "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe", + "CONCEPT_ID" : 2777699, + "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Approach, Diagnostic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP991291", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "0VB03ZX", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 37592548, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] by HVD", + "CONCEPT_ID" : 2777702, + "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Endoscopic Approach", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4781994", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "0VB04ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40224085, - "CONCEPT_NAME" : "250 ML sipuleucel-T 200000 CELLS/ML Injection [Provenge]", + "CONCEPT_ID" : 2777701, + "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Endoscopic Approach, Diagnostic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "997267", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Quant Branded Drug" + "CONCEPT_CODE" : "0VB04ZX", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40224086, - "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML [Provenge]", + "CONCEPT_ID" : 2777704, + "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "997265", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug Comp" + "CONCEPT_CODE" : "0VB07ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40224095, - "CONCEPT_NAME" : "sipuleucel-T", + "CONCEPT_ID" : 2777703, + "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening, Diagnostic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "997261", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CODE" : "0VB07ZX", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40224096, - "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML", + "CONCEPT_ID" : 2777706, + "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening Endoscopic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "997262", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug Comp" + "CONCEPT_CODE" : "0VB08ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40224097, - "CONCEPT_NAME" : "250 ML sipuleucel-T 200000 CELLS/ML Injection", + "CONCEPT_ID" : 2777705, + "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening Endoscopic, Diagnostic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "997264", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Quant Clinical Drug" + "CONCEPT_CODE" : "0VB08ZX", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40716385, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by Merck", + "CONCEPT_ID" : 44783041, + "CONCEPT_NAME" : "Holmium laser enucleation of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4740730", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "699075006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40745552, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] Box of 1 by Merck", + "CONCEPT_ID" : 4239543, + "CONCEPT_NAME" : "One stage subtotal suprapubic prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4711640", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" - }, - "isExcluded" : false, + "CONCEPT_CODE" : "91531008", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40745553, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] Box of 1", + "CONCEPT_ID" : 2003966, + "CONCEPT_NAME" : "Other transurethral prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4711639", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CODE" : "60.29", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD9Proc", + "CONCEPT_CLASS_ID" : "4-dig billing code" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40745554, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Merck", + "CONCEPT_ID" : 4021570, + "CONCEPT_NAME" : "Radical cystoprostatourethrectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4711638", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "176106009", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40745555, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda]", + "CONCEPT_ID" : 2780477, + "CONCEPT_NAME" : "Resection of Prostate, Open Approach", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4711637", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "0VT00ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 41079944, - "CONCEPT_NAME" : "sipuleucel-T Injectable Solution", + "CONCEPT_ID" : 2780478, + "CONCEPT_NAME" : "Resection of Prostate, Percutaneous Endoscopic Approach", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP2277906", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "0VT04ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 41122672, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] Box of 1", + "CONCEPT_ID" : 2780479, + "CONCEPT_NAME" : "Resection of Prostate, Via Natural or Artificial Opening", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP2320634", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CODE" : "0VT07ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 41133743, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] Box of 1 by Merck", + "CONCEPT_ID" : 2780480, + "CONCEPT_NAME" : "Resection of Prostate, Via Natural or Artificial Opening Endoscopic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP2331705", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "0VT08ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 41271431, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension Box of 1", + "CONCEPT_ID" : 4341384, + "CONCEPT_NAME" : "Salvage cystoprostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP2469393", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "CONCEPT_CODE" : "236211007", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 42658251, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by MSD", + "CONCEPT_ID" : 4341893, + "CONCEPT_NAME" : "Salvage cystoprostatourethrectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4869815", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "236209003", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 42921578, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda]", + "CONCEPT_ID" : 4212360, + "CONCEPT_NAME" : "Subtotal perineal prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4648403", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Branded Drug" + "CONCEPT_CODE" : "57525009", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 42963145, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injectable Solution [Keytruda]", + "CONCEPT_ID" : 4147673, + "CONCEPT_NAME" : "Subtotal prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4689628", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "30426000", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 42963146, - "CONCEPT_NAME" : "pembrolizumab Injectable Solution [Keytruda]", + "CONCEPT_ID" : 4078386, + "CONCEPT_NAME" : "Subtotal retropubic prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4689629", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Form" + "CONCEPT_CODE" : "19149007", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 43173544, - "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe [Keytruda] Box of 1 by Merck", + "CONCEPT_ID" : 4073700, + "CONCEPT_NAME" : "Transurethral laser prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP496837", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "176288003", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44075484, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] by Merck", + "CONCEPT_ID" : 4234536, + "CONCEPT_NAME" : "Transurethral prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1070115", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "90199006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44081458, - "CONCEPT_NAME" : "pembrolizumab Injectable Suspension", + "CONCEPT_ID" : 4287859, + "CONCEPT_NAME" : "Transurethral resection of prostate, first stage of two stages", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1076089", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "68986004", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44082527, - "CONCEPT_NAME" : "pembrolizumab Injectable Suspension [Keytruda]", + "CONCEPT_ID" : 44783043, + "CONCEPT_NAME" : "Transurethral thulium laser enucleation of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1077158", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Form" + "CONCEPT_CODE" : "699077003", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44084103, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension", + "CONCEPT_ID" : 4071791, + "CONCEPT_NAME" : "Transvesical two stage prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1078734", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "176260009", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44124784, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda]", + "CONCEPT_ID" : 4054558, + "CONCEPT_NAME" : "Two stage subtotal suprapubic prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1119415", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "21190008", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44164861, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injectable Solution Box of 1", + "CONCEPT_ID" : 4330932, + "CONCEPT_NAME" : "CT of prostate for radiotherapy planning", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3041584", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "CONCEPT_CODE" : "429856001", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -3793,16 +3978,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44164862, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injectable Solution", + "CONCEPT_ID" : 37396025, + "CONCEPT_NAME" : "CT of prostate with contrast for radiotherapy planning", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3041585", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "715687002", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -3810,16 +3995,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44175744, - "CONCEPT_NAME" : "pembrolizumab Injectable Solution", + "CONCEPT_ID" : 2108724, + "CONCEPT_NAME" : "External beam radiotherapy as primary therapy to prostate with or without nodal irradiation (PRCA)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3052467", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "4200F", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" }, "isExcluded" : false, "includeDescendants" : true, @@ -3827,16 +4012,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44184353, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection [Keytruda] Box of 1", + "CONCEPT_ID" : 2108725, + "CONCEPT_NAME" : "External beam radiotherapy with or without nodal irradiation as adjuvant or salvage therapy for prostate cancer patient (PRCA)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3061076", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CODE" : "4201F", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" }, "isExcluded" : false, "includeDescendants" : true, @@ -3844,16 +4029,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44191541, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda] Box of 1", + "CONCEPT_ID" : 4198015, + "CONCEPT_NAME" : "MRI of prostate for radiotherapy planning", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3068264", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Branded Box" + "CONCEPT_CODE" : "431850000", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -3861,16 +4046,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44191562, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution", + "CONCEPT_ID" : 43533205, + "CONCEPT_NAME" : "Low dose rate (ldr) prostate brachytherapy services, composite rate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3068285", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Clinical Drug" + "CONCEPT_CODE" : "G0458", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "HCPCS", + "CONCEPT_CLASS_ID" : "HCPCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -3878,16 +4063,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44191588, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution Box of 1", + "CONCEPT_ID" : 2790073, + "CONCEPT_NAME" : "Contact Radiation of Prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3068311", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Clinical Box" + "CONCEPT_CODE" : "DVY07ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -3895,16 +4080,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44191599, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda] Box of 1 by Merck", + "CONCEPT_ID" : 1781260, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Cesium 131 (Cs-131)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3068322", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "DV10B6Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -3912,16 +4097,16 @@ }, { "concept" : { - "CONCEPT_ID" : 45775965, - "CONCEPT_NAME" : "pembrolizumab", + "CONCEPT_ID" : 4041984, + "CONCEPT_NAME" : "Laser ablation of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1547545", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CODE" : "118164001", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -3929,16 +4114,16 @@ }, { "concept" : { - "CONCEPT_ID" : 45775966, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML", + "CONCEPT_ID" : 2789856, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Other Isotope", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1547546", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug Comp" + "CONCEPT_CODE" : "DV10BYZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -3946,16 +4131,16 @@ }, { "concept" : { - "CONCEPT_ID" : 45775970, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML [Keytruda]", + "CONCEPT_ID" : 1524039, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Palladium 103 (Pd-103), Unidirectional Source", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1547551", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug Comp" + "CONCEPT_CODE" : "DV10BB1", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -3963,16 +4148,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276407, - "CONCEPT_NAME" : "pembrolizumab 50 MG", + "CONCEPT_ID" : 37111533, + "CONCEPT_NAME" : "Ultrasonography guided transrectal cryoablation of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657744", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug Comp" + "CONCEPT_CODE" : "726544002", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -3980,16 +4165,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276408, - "CONCEPT_NAME" : "pembrolizumab Injection", + "CONCEPT_ID" : 4061656, + "CONCEPT_NAME" : "Microwave therapy to prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657745", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "169429005", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -3997,16 +4182,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276409, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection", + "CONCEPT_ID" : 2789850, + "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Other Isotope", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657746", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "DV109YZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4014,16 +4199,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276410, - "CONCEPT_NAME" : "pembrolizumab 50 MG [Keytruda]", + "CONCEPT_ID" : 2789851, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Cesium 137 (Cs-137)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657747", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug Comp" + "CONCEPT_CODE" : "DV10B7Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4031,16 +4216,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276411, - "CONCEPT_NAME" : "pembrolizumab Injection [Keytruda]", + "CONCEPT_ID" : 2789848, + "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Palladium 103 (Pd-103)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657748", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug Form" + "CONCEPT_CODE" : "DV109BZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4048,16 +4233,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276412, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda]", + "CONCEPT_ID" : 2789849, + "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Californium 252 (Cf-252)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657749", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "DV109CZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4065,16 +4250,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276413, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection", + "CONCEPT_ID" : 2789854, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Palladium 103 (Pd-103)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657750", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Quant Clinical Drug" + "CONCEPT_CODE" : "DV10BBZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4082,16 +4267,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276414, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda]", + "CONCEPT_ID" : 2789855, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Californium 252 (Cf-252)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657751", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Quant Branded Drug" + "CONCEPT_CODE" : "DV10BCZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4099,16 +4284,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276415, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection", + "CONCEPT_ID" : 2789852, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Iridium 192 (Ir-192)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657752", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "DV10B8Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4116,41 +4301,33 @@ }, { "concept" : { - "CONCEPT_ID" : 46276416, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection [Keytruda]", + "CONCEPT_ID" : 2789853, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Iodine 125 (I-125)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657753", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "DV10B9Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 19, - "name" : "[PIONEER V2.0] Radium-223", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 45775578, - "CONCEPT_NAME" : "radium", + "CONCEPT_ID" : 2789846, + "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Iridium 192 (Ir-192)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1546450", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CODE" : "DV1098Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4158,16 +4335,16 @@ }, { "concept" : { - "CONCEPT_ID" : 902727, - "CONCEPT_NAME" : "Radium-223", + "CONCEPT_ID" : 2789847, + "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Iodine 125 (I-125)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP5042947", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CODE" : "DV1099Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4175,37 +4352,275 @@ }, { "concept" : { - "CONCEPT_ID" : 41267222, - "CONCEPT_NAME" : "Radium Oral Solution", + "CONCEPT_ID" : 2789845, + "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Cesium 137 (Cs-137)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP2465184", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "DV1097Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : true, - "includeDescendants" : false, + "isExcluded" : false, + "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 43526934, - "CONCEPT_NAME" : "radium chloride Ra-223", + "CONCEPT_ID" : 759648, + "CONCEPT_NAME" : "Ablation of malignant prostate tissue, transrectal, with high intensity-focused ultrasound (HIFU), including ultrasound guidance", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1424174", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CODE" : "55880", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4073126, + "CONCEPT_NAME" : "Cryotherapy to prostate via perineal probe", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176319004", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2110047, + "CONCEPT_NAME" : "Transperineal placement of needles or catheters into prostate for interstitial radioelement application, with or without cystoscopy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "55875", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 37111533, + "CONCEPT_NAME" : "Ultrasonography guided transrectal cryoablation of prostate", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "726544002", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2110046, + "CONCEPT_NAME" : "Cryosurgical ablation of the prostate (includes ultrasonic guidance and monitoring)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "55873", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2110035, + "CONCEPT_NAME" : "Prostatectomy (including control of postoperative bleeding, vasectomy, meatotomy, urethral calibration and/or dilation, and internal urethrotomy); suprapubic, subtotal, 1 or 2 stages", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "55821", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2108678, + "CONCEPT_NAME" : "Adjuvant (ie, in combination with external beam radiotherapy to the prostate for prostate cancer) hormonal therapy (gonadotropin-releasing hormone [GnRH] agonist or antagonist) prescribed/administered (PRCA)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "4164F", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2101059, + "CONCEPT_NAME" : "Anesthesia for; perineal prostatectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "00908", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2777698, + "CONCEPT_NAME" : "Excision of Prostate, Open Approach", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "0VB00ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 40490346, + "CONCEPT_NAME" : "Transrectal high intensity focused ultrasound ablation of prostate", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "446941000", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2110043, + "CONCEPT_NAME" : "Exposure of prostate, any approach, for insertion of radioactive substance; with bilateral pelvic lymphadenectomy, including external iliac, hypogastric and obturator nodes", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "55865", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2789830, + "CONCEPT_NAME" : "Beam Radiation of Prostate using Photons >10 MeV", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "DV002ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 709928, + "CONCEPT_NAME" : "Transurethral ablation of malignant prostate tissue by high-energy water vapor thermotherapy, including intraoperative imaging and needle guidance", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "0582T", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 42733763, + "CONCEPT_NAME" : "Transurethral resection of prostate; first stage of two-stage resection (partial resection) (Deprecated)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "52612", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 42733764, + "CONCEPT_NAME" : "Transurethral resection of prostate; second stage of two-stage resection (resection completed) (Deprecated)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "52614", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false } ] } @@ -4215,7 +4630,7 @@ "Type" : "First" }, "ExpressionLimit" : { - "Type" : "First" + "Type" : "All" }, "InclusionRules" : [ { @@ -4261,320 +4676,354 @@ } }, { - "name" : "metastasis", + "name" : "no other drugs", "expression" : { "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 14, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 15, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 16, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 17, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 13, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 12, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + }, + { + "name" : "No other primary", + "expression" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "ConditionOccurrence" : { + "CodesetId" : 10, + "ConditionTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "Observation" : { + "CodesetId" : 10, + "ObservationTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + }, + { + "name" : "metastasis", + "expression" : { + "Type" : "ANY", "CriteriaList" : [], "DemographicCriteriaList" : [], "Groups" : [ { - "Type" : "ANY", + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { "ConditionOccurrence" : { "CorrelatedCriteria" : { "Type" : "ALL", - "CriteriaList" : [], - "DemographicCriteriaList" : [], - "Groups" : [ + "CriteriaList" : [ { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "ConditionOccurrence" : { - "CodesetId" : 2, - "ConditionTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 30, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } + "Criteria" : { + "ConditionOccurrence" : { + "CodesetId" : 2, + "ConditionTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 }, - { - "Criteria" : { - "ProcedureOccurrence" : { - "CodesetId" : 4, - "ProcedureTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 1, - "Coeff" : -1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } + "End" : { + "Days" : 30, + "Coeff" : 1 }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 183, - "Coeff" : -1 - }, - "End" : { - "Days" : 1, - "Coeff" : -1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } }, { - "Type" : "ANY", - "CriteriaList" : [ - { - "Criteria" : { - "ProcedureOccurrence" : { - "CodesetId" : 11, - "ProcedureTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 184, - "Coeff" : -1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "Observation" : { - "CodesetId" : 11, - "ObservationTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 184, - "Coeff" : -1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 11, + "DrugTypeExclude" : false } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - }, - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } + "End" : { + "Days" : 1, + "Coeff" : -1 }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "ProcedureOccurrence" : { + "CodesetId" : 4, + "ProcedureTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 18, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } + "End" : { + "Days" : 1, + "Coeff" : -1 }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [ + { + "Type" : "ANY", + "CriteriaList" : [ { "Criteria" : { - "DrugExposure" : { + "Observation" : { "CodesetId" : 19, - "DrugTypeExclude" : false + "ObservationTypeExclude" : false } }, "StartWindow" : { "Start" : { - "Days" : 0, "Coeff" : -1 }, "End" : { - "Days" : 183, - "Coeff" : 1 + "Days" : 184, + "Coeff" : -1 }, "UseIndexEnd" : false, "UseEventEnd" : false @@ -4582,26 +5031,25 @@ "RestrictVisit" : false, "IgnoreObservationPeriod" : false, "Occurrence" : { - "Type" : 0, - "Count" : 0, + "Type" : 2, + "Count" : 1, "IsDistinct" : false } }, { "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false + "ProcedureOccurrence" : { + "CodesetId" : 19, + "ProcedureTypeExclude" : false } }, "StartWindow" : { "Start" : { - "Days" : 0, - "Coeff" : 1 + "Coeff" : -1 }, "End" : { - "Days" : 183, - "Coeff" : 1 + "Days" : 184, + "Coeff" : -1 }, "UseIndexEnd" : false, "UseEventEnd" : false @@ -4660,7 +5108,6 @@ }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -4680,9 +5127,9 @@ }, { "Criteria" : { - "ProcedureOccurrence" : { - "CodesetId" : 4, - "ProcedureTypeExclude" : false + "DrugExposure" : { + "CodesetId" : 11, + "DrugTypeExclude" : false } }, "StartWindow" : { @@ -4706,14 +5153,13 @@ }, { "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false + "ProcedureOccurrence" : { + "CodesetId" : 4, + "ProcedureTypeExclude" : false } }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -4740,7 +5186,7 @@ { "Criteria" : { "Observation" : { - "CodesetId" : 11, + "CodesetId" : 19, "ObservationTypeExclude" : false } }, @@ -4766,7 +5212,7 @@ { "Criteria" : { "ProcedureOccurrence" : { - "CodesetId" : 11, + "CodesetId" : 19, "ProcedureTypeExclude" : false } }, @@ -4792,208 +5238,62 @@ ], "DemographicCriteriaList" : [], "Groups" : [] - }, - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 18, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 19, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : 1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] } ] }, - "CodesetId" : 6, + "CodesetId" : 7, "First" : true, - "MeasurementTypeExclude" : false + "MeasurementTypeExclude" : false, + "ValueAsConcept" : [ + { + "CONCEPT_ID" : 45878386, + "CONCEPT_NAME" : "M1C", + "STANDARD_CONCEPT" : null, + "STANDARD_CONCEPT_CAPTION" : "Unknown", + "INVALID_REASON" : null, + "INVALID_REASON_CAPTION" : "Unknown", + "CONCEPT_CODE" : "LA4625-5", + "DOMAIN_ID" : "Meas Value", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : null + }, + { + "CONCEPT_ID" : 45881618, + "CONCEPT_NAME" : "M1B", + "STANDARD_CONCEPT" : null, + "STANDARD_CONCEPT_CAPTION" : "Unknown", + "INVALID_REASON" : null, + "INVALID_REASON_CAPTION" : "Unknown", + "CONCEPT_CODE" : "LA4626-3", + "DOMAIN_ID" : "Meas Value", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : null + }, + { + "CONCEPT_ID" : 45882500, + "CONCEPT_NAME" : "M1A", + "STANDARD_CONCEPT" : null, + "STANDARD_CONCEPT_CAPTION" : "Unknown", + "INVALID_REASON" : null, + "INVALID_REASON_CAPTION" : "Unknown", + "CONCEPT_CODE" : "LA4627-1", + "DOMAIN_ID" : "Meas Value", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : null + }, + { + "CONCEPT_ID" : 45876322, + "CONCEPT_NAME" : "M1", + "STANDARD_CONCEPT" : null, + "STANDARD_CONCEPT_CAPTION" : "Unknown", + "INVALID_REASON" : null, + "INVALID_REASON_CAPTION" : "Unknown", + "CONCEPT_CODE" : "LA4628-9", + "DOMAIN_ID" : "Meas Value", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : null + } + ] } }, "StartWindow" : { @@ -5031,7 +5331,6 @@ }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -5051,9 +5350,9 @@ }, { "Criteria" : { - "ProcedureOccurrence" : { - "CodesetId" : 4, - "ProcedureTypeExclude" : false + "DrugExposure" : { + "CodesetId" : 11, + "DrugTypeExclude" : false } }, "StartWindow" : { @@ -5077,14 +5376,13 @@ }, { "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false + "ProcedureOccurrence" : { + "CodesetId" : 4, + "ProcedureTypeExclude" : false } }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -5108,36 +5406,10 @@ { "Type" : "ANY", "CriteriaList" : [ - { - "Criteria" : { - "ProcedureOccurrence" : { - "CodesetId" : 11, - "ProcedureTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 184, - "Coeff" : -1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, { "Criteria" : { "Observation" : { - "CodesetId" : 11, + "CodesetId" : 19, "ObservationTypeExclude" : false } }, @@ -5159,191 +5431,21 @@ "Count" : 1, "IsDistinct" : false } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - }, - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 18, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } }, { "Criteria" : { - "DrugExposure" : { + "ProcedureOccurrence" : { "CodesetId" : 19, - "DrugTypeExclude" : false + "ProcedureTypeExclude" : false } }, "StartWindow" : { "Start" : { - "Days" : 0, "Coeff" : -1 }, "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : 1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 + "Days" : 184, + "Coeff" : -1 }, "UseIndexEnd" : false, "UseEventEnd" : false @@ -5362,59 +5464,9 @@ } ] }, - "CodesetId" : 9, + "CodesetId" : 6, "First" : true, - "MeasurementTypeExclude" : false, - "ValueAsConcept" : [ - { - "CONCEPT_ID" : 45878386, - "CONCEPT_NAME" : "M1C", - "STANDARD_CONCEPT" : null, - "STANDARD_CONCEPT_CAPTION" : "Unknown", - "INVALID_REASON" : null, - "INVALID_REASON_CAPTION" : "Unknown", - "CONCEPT_CODE" : "LA4625-5", - "DOMAIN_ID" : "Meas Value", - "VOCABULARY_ID" : "LOINC", - "CONCEPT_CLASS_ID" : null - }, - { - "CONCEPT_ID" : 45881618, - "CONCEPT_NAME" : "M1B", - "STANDARD_CONCEPT" : null, - "STANDARD_CONCEPT_CAPTION" : "Unknown", - "INVALID_REASON" : null, - "INVALID_REASON_CAPTION" : "Unknown", - "CONCEPT_CODE" : "LA4626-3", - "DOMAIN_ID" : "Meas Value", - "VOCABULARY_ID" : "LOINC", - "CONCEPT_CLASS_ID" : null - }, - { - "CONCEPT_ID" : 45882500, - "CONCEPT_NAME" : "M1A", - "STANDARD_CONCEPT" : null, - "STANDARD_CONCEPT_CAPTION" : "Unknown", - "INVALID_REASON" : null, - "INVALID_REASON_CAPTION" : "Unknown", - "CONCEPT_CODE" : "LA4627-1", - "DOMAIN_ID" : "Meas Value", - "VOCABULARY_ID" : "LOINC", - "CONCEPT_CLASS_ID" : null - }, - { - "CONCEPT_ID" : 45876322, - "CONCEPT_NAME" : "M1", - "STANDARD_CONCEPT" : null, - "STANDARD_CONCEPT_CAPTION" : "Unknown", - "INVALID_REASON" : null, - "INVALID_REASON_CAPTION" : "Unknown", - "CONCEPT_CODE" : "LA4628-9", - "DOMAIN_ID" : "Meas Value", - "VOCABULARY_ID" : "LOINC", - "CONCEPT_CLASS_ID" : null - } - ] + "MeasurementTypeExclude" : false } }, "StartWindow" : { @@ -5443,48 +5495,12 @@ } ] } - }, - { - "name" : "no other primary", - "expression" : { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "ConditionOccurrence" : { - "CodesetId" : 12, - "ConditionTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 30, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } } ], "CensoringCriteria" : [ { "ConditionOccurrence" : { - "CodesetId" : 12, + "CodesetId" : 10, "ConditionTypeExclude" : false } } diff --git a/inst/cohorts/116.json b/inst/cohorts/116.json index a1d9a7d..9f2171e 100644 --- a/inst/cohorts/116.json +++ b/inst/cohorts/116.json @@ -4,7 +4,41 @@ "CriteriaList" : [ { "DrugExposure" : { - "CodesetId" : 13, + "CorrelatedCriteria" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 13, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + }, + "CodesetId" : 11, "OccurrenceStartDate" : { "Value" : "2016-01-01", "Op" : "bt", @@ -15,8 +49,41 @@ }, { "ProcedureOccurrence" : { + "CorrelatedCriteria" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 13, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + }, "CodesetId" : 4, - "First" : true, "OccurrenceStartDate" : { "Value" : "2016-01-01", "Op" : "bt", @@ -27,7 +94,68 @@ }, { "DrugExposure" : { - "CodesetId" : 15, + "CorrelatedCriteria" : { + "Type" : "ANY", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 11, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "ProcedureOccurrence" : { + "CodesetId" : 4, + "ProcedureTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + }, + "CodesetId" : 13, "OccurrenceStartDate" : { "Value" : "2016-01-01", "Op" : "bt", @@ -42,7 +170,7 @@ "PostDays" : 0 }, "PrimaryCriteriaLimit" : { - "Type" : "All" + "Type" : "First" } }, "ConceptSets" : [ @@ -101,6 +229,74 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264861, + "CONCEPT_NAME" : "pM1c: Distant metastasis site other than bone or non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397215009", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264288, + "CONCEPT_NAME" : "pM1b: Distant metastasis to bone(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397214008", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4246703, + "CONCEPT_NAME" : "pM1a: Distant metastasis to non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397213002", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 763131, + "CONCEPT_NAME" : "Neoplasm of prostate distant metastasis staging category M1: Distant metastasis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "436401000124103", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false } ] } @@ -188,13 +384,47 @@ }, { "concept" : { - "CONCEPT_ID" : 4145907, - "CONCEPT_NAME" : "Orchiectomy of remaining testis", + "CONCEPT_ID" : 4304921, + "CONCEPT_NAME" : "Bilateral orchidectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "34426006", + "CONCEPT_CODE" : "386634006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4073142, + "CONCEPT_NAME" : "Bilateral total orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176416007", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4073143, + "CONCEPT_NAME" : "Bilateral total scrotal orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176418008", "DOMAIN_ID" : "Procedure", "VOCABULARY_ID" : "SNOMED", "CONCEPT_CLASS_ID" : "Procedure" @@ -220,6 +450,57 @@ "includeDescendants" : true, "includeMapped" : false }, + { + "concept" : { + "CONCEPT_ID" : 4012324, + "CONCEPT_NAME" : "Bilateral cryptorchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "112910006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4073141, + "CONCEPT_NAME" : "Bilateral subcapsular orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176415006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4071936, + "CONCEPT_NAME" : "Bilateral total inguinal orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176417003", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, { "concept" : { "CONCEPT_ID" : 35608156, @@ -511,23 +792,40 @@ }, { "concept" : { - "CONCEPT_ID" : 4012324, - "CONCEPT_NAME" : "Bilateral cryptorchidectomy", + "CONCEPT_ID" : 4341536, + "CONCEPT_NAME" : "Total orchidectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "112910006", + "CONCEPT_CODE" : "236334001", "DOMAIN_ID" : "Procedure", "VOCABULARY_ID" : "SNOMED", "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } + }, + { + "concept" : { + "CONCEPT_ID" : 4145907, + "CONCEPT_NAME" : "Orchiectomy of remaining testis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "34426006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + } + ] + } }, { "id" : 6, @@ -572,7 +870,7 @@ } }, { - "id" : 9, + "id" : 7, "name" : "[PIONEER 2.0] Metastasis measurement require value", "expression" : { "items" : [ @@ -597,73 +895,73 @@ } }, { - "id" : 11, - "name" : "[Pioneer 2.0] Local trt", + "id" : 10, + "name" : "[PIONEER 2.0] other primaries", "expression" : { "items" : [ { "concept" : { - "CONCEPT_ID" : 4235738, - "CONCEPT_NAME" : "Prostatectomy", + "CONCEPT_ID" : 432851, + "CONCEPT_NAME" : "Secondary malignant neoplastic disease", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "90470006", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "128462008", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 2108677, - "CONCEPT_NAME" : "Patient counseling at a minimum on all of the following treatment options for clinically localized prostate cancer: active surveillance, and interstitial prostate brachytherapy, and external beam radiotherapy, and radical prostatectomy, provided prior to ", + "CONCEPT_ID" : 443392, + "CONCEPT_NAME" : "Malignant neoplastic disease", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "4163F", - "DOMAIN_ID" : "Observation", - "VOCABULARY_ID" : "CPT4", - "CONCEPT_CLASS_ID" : "CPT4" + "CONCEPT_CODE" : "363346000", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4216658, - "CONCEPT_NAME" : "Radical cystoprostatectomy", + "CONCEPT_ID" : 4112752, + "CONCEPT_NAME" : "Basal cell carcinoma of skin", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "81232004", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "254701007", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, - "includeDescendants" : false, + "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4306299, - "CONCEPT_NAME" : "Excision of lesion of prostate", + "CONCEPT_ID" : 4111921, + "CONCEPT_NAME" : "Squamous cell carcinoma of skin", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "83154001", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "254651007", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -671,16 +969,16 @@ }, { "concept" : { - "CONCEPT_ID" : 4338661, - "CONCEPT_NAME" : "Complete transurethral resection of prostate, including control of postoperative bleeding", + "CONCEPT_ID" : 764971, + "CONCEPT_NAME" : "Prostate cancer metastatic to eye", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "87795007", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "96901000119105", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -688,16 +986,16 @@ }, { "concept" : { - "CONCEPT_ID" : 3187777, - "CONCEPT_NAME" : "Cystoscopy with transurethral prostatectomy", + "CONCEPT_ID" : 36716186, + "CONCEPT_NAME" : "Hormone sensitive prostate cancer", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "21360001000004106", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "Nebraska Lexicon", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "722103009", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -705,16 +1003,16 @@ }, { "concept" : { - "CONCEPT_ID" : 40487861, - "CONCEPT_NAME" : "Endoscopic excision of prostate using holmium laser", + "CONCEPT_ID" : 200962, + "CONCEPT_NAME" : "Primary malignant neoplasm of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "446445003", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "93974005", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -722,16 +1020,16 @@ }, { "concept" : { - "CONCEPT_ID" : 4176312, - "CONCEPT_NAME" : "Endoscopic laser prostatectomy", + "CONCEPT_ID" : 36712762, + "CONCEPT_NAME" : "Recurrent malignant neoplasm of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "427985002", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "1098981000119101", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -739,16 +1037,16 @@ }, { "concept" : { - "CONCEPT_ID" : 4193061, - "CONCEPT_NAME" : "Endoscopic resection of prostate using an electrotome", + "CONCEPT_ID" : 37395835, + "CONCEPT_NAME" : "Familial prostate cancer", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "314202001", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "715412008", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -756,16 +1054,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777698, - "CONCEPT_NAME" : "Excision of Prostate, Open Approach", + "CONCEPT_ID" : 4164017, + "CONCEPT_NAME" : "Squamous cell carcinoma of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB00ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "399590005", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -773,16 +1071,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777697, - "CONCEPT_NAME" : "Excision of Prostate, Open Approach, Diagnostic", + "CONCEPT_ID" : 4141960, + "CONCEPT_NAME" : "Hormone refractory prostate cancer", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB00ZX", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "427492003", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -790,16 +1088,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777700, - "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Approach", + "CONCEPT_ID" : 4163261, + "CONCEPT_NAME" : "Malignant tumor of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB03ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "399068003", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -807,16 +1105,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777699, - "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Approach, Diagnostic", + "CONCEPT_ID" : 4183913, + "CONCEPT_NAME" : "Malignant tumor involving an organ by direct extension from prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB03ZX", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "369598006", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -824,16 +1122,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777702, - "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Endoscopic Approach", + "CONCEPT_ID" : 4283614, + "CONCEPT_NAME" : "Malignant tumor involving bladder by direct extension from prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB04ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "369472002", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -841,16 +1139,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777701, - "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Endoscopic Approach, Diagnostic", + "CONCEPT_ID" : 4289246, + "CONCEPT_NAME" : "Malignant tumor involving rectum by direct extension from prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB04ZX", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "369451000", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -858,16 +1156,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777704, - "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening", + "CONCEPT_ID" : 4283740, + "CONCEPT_NAME" : "Malignant tumor involving seminal vesicle by direct extension from prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB07ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "369490001", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -875,16 +1173,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777703, - "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening, Diagnostic", + "CONCEPT_ID" : 4280897, + "CONCEPT_NAME" : "Malignant tumor involving urethra by direct extension from prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB07ZX", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "369466002", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -892,16 +1190,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777706, - "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening Endoscopic", + "CONCEPT_ID" : 4289379, + "CONCEPT_NAME" : "Malignant tumor involving vasa deferentia by direct extension from prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB08ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "369483006", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -909,356 +1207,380 @@ }, { "concept" : { - "CONCEPT_ID" : 2777705, - "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening Endoscopic, Diagnostic", + "CONCEPT_ID" : 4312326, + "CONCEPT_NAME" : "Neoplasm, malignant (primary)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB08ZX", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "86049000", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Morph Abnormality" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 11, + "name" : "[PIONEER V2.0] ADT (LHRH & anti-androgen)", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 44783041, - "CONCEPT_NAME" : "Holmium laser enucleation of prostate", + "CONCEPT_ID" : 19058410, + "CONCEPT_NAME" : "degarelix", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "699075006", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "475230", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4239543, - "CONCEPT_NAME" : "One stage subtotal suprapubic prostatectomy", + "CONCEPT_ID" : 739471, + "CONCEPT_NAME" : "relugolix", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "91531008", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "2472778", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 2003966, - "CONCEPT_NAME" : "Other transurethral prostatectomy", + "CONCEPT_ID" : 35834903, + "CONCEPT_NAME" : "relugolix", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "60.29", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD9Proc", - "CONCEPT_CLASS_ID" : "4-dig billing code" + "CONCEPT_CODE" : "OMOP5040508", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4021570, - "CONCEPT_NAME" : "Radical cystoprostatourethrectomy", + "CONCEPT_ID" : 1343039, + "CONCEPT_NAME" : "triptorelin", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "176106009", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "38782", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 2780477, - "CONCEPT_NAME" : "Resection of Prostate, Open Approach", + "CONCEPT_ID" : 19089810, + "CONCEPT_NAME" : "gonadorelin", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VT00ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "6384", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 2780478, - "CONCEPT_NAME" : "Resection of Prostate, Percutaneous Endoscopic Approach", + "CONCEPT_ID" : 1366310, + "CONCEPT_NAME" : "goserelin", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VT04ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "50610", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 2780479, - "CONCEPT_NAME" : "Resection of Prostate, Via Natural or Artificial Opening", + "CONCEPT_ID" : 1351541, + "CONCEPT_NAME" : "leuprolide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VT07ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "42375", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 2780480, - "CONCEPT_NAME" : "Resection of Prostate, Via Natural or Artificial Opening Endoscopic", + "CONCEPT_ID" : 1344381, + "CONCEPT_NAME" : "bicalutamide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VT08ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "83008", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4341384, - "CONCEPT_NAME" : "Salvage cystoprostatectomy", + "CONCEPT_ID" : 19010792, + "CONCEPT_NAME" : "cyproterone", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "236211007", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "3014", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4341893, - "CONCEPT_NAME" : "Salvage cystoprostatourethrectomy", + "CONCEPT_ID" : 1356461, + "CONCEPT_NAME" : "flutamide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "236209003", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "4508", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4212360, - "CONCEPT_NAME" : "Subtotal perineal prostatectomy", + "CONCEPT_ID" : 1500211, + "CONCEPT_NAME" : "medroxyprogesterone", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "57525009", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "6691", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4147673, - "CONCEPT_NAME" : "Subtotal prostatectomy", + "CONCEPT_ID" : 1300978, + "CONCEPT_NAME" : "megestrol", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "30426000", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "6703", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4078386, - "CONCEPT_NAME" : "Subtotal retropubic prostatectomy", + "CONCEPT_ID" : 1315286, + "CONCEPT_NAME" : "nilutamide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "19149007", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "31805", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4073700, - "CONCEPT_NAME" : "Transurethral laser prostatectomy", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", + "CONCEPT_ID" : 35807385, + "CONCEPT_NAME" : "GnRH agonist", + "STANDARD_CONCEPT" : "C", + "STANDARD_CONCEPT_CAPTION" : "Classification", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "176288003", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "45768", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "HemOnc", + "CONCEPT_CLASS_ID" : "Component Class" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4234536, - "CONCEPT_NAME" : "Transurethral prostatectomy", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", + "CONCEPT_ID" : 35807349, + "CONCEPT_NAME" : "GnRH antagonist", + "STANDARD_CONCEPT" : "C", + "STANDARD_CONCEPT_CAPTION" : "Classification", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "90199006", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "45632", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "HemOnc", + "CONCEPT_CLASS_ID" : "Component Class" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 12, + "name" : "[PIONEER V2.0] ARTA", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 4287859, - "CONCEPT_NAME" : "Transurethral resection of prostate, first stage of two stages", + "CONCEPT_ID" : 40239056, + "CONCEPT_NAME" : "abiraterone", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "68986004", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "1100072", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44783043, - "CONCEPT_NAME" : "Transurethral thulium laser enucleation of prostate", + "CONCEPT_ID" : 963987, + "CONCEPT_NAME" : "apalutamide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "699077003", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "1999574", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4071791, - "CONCEPT_NAME" : "Transvesical two stage prostatectomy", + "CONCEPT_ID" : 42900250, + "CONCEPT_NAME" : "enzalutamide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "176260009", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "1307298", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4054558, - "CONCEPT_NAME" : "Two stage subtotal suprapubic prostatectomy", + "CONCEPT_ID" : 1361291, + "CONCEPT_NAME" : "darolutamide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "21190008", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "2180325", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 13, + "name" : "[PIONEER V2.0] Chemotherapy (docetaxel & cabazitaxe & paclitaxel)", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 4330932, - "CONCEPT_NAME" : "CT of prostate for radiotherapy planning", + "CONCEPT_ID" : 1315942, + "CONCEPT_NAME" : "docetaxel", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "429856001", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "72962", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -1266,16 +1588,16 @@ }, { "concept" : { - "CONCEPT_ID" : 37396025, - "CONCEPT_NAME" : "CT of prostate with contrast for radiotherapy planning", + "CONCEPT_ID" : 40222431, + "CONCEPT_NAME" : "cabazitaxel", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "715687002", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "996051", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -1283,50 +1605,66 @@ }, { "concept" : { - "CONCEPT_ID" : 2108724, - "CONCEPT_NAME" : "External beam radiotherapy as primary therapy to prostate with or without nodal irradiation (PRCA)", + "CONCEPT_ID" : 1378382, + "CONCEPT_NAME" : "paclitaxel", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "4200F", - "DOMAIN_ID" : "Observation", - "VOCABULARY_ID" : "CPT4", - "CONCEPT_CLASS_ID" : "CPT4" + "CONCEPT_CODE" : "56946", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 14, + "name" : "[PIONEER V2.0] Lutetium", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 2108725, - "CONCEPT_NAME" : "External beam radiotherapy with or without nodal irradiation as adjuvant or salvage therapy for prostate cancer patient (PRCA)", + "CONCEPT_ID" : 44816340, + "CONCEPT_NAME" : "lutetium", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "4201F", - "DOMAIN_ID" : "Observation", - "VOCABULARY_ID" : "CPT4", - "CONCEPT_CLASS_ID" : "CPT4" + "CONCEPT_CODE" : "1534772", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 15, + "name" : "[PIONEER V2.0] PARP inhibitor", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 4198015, - "CONCEPT_NAME" : "MRI of prostate for radiotherapy planning", + "CONCEPT_ID" : 45892579, + "CONCEPT_NAME" : "olaparib", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "431850000", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "1597582", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -1334,33 +1672,41 @@ }, { "concept" : { - "CONCEPT_ID" : 43533205, - "CONCEPT_NAME" : "Low dose rate (ldr) prostate brachytherapy services, composite rate", + "CONCEPT_ID" : 1718850, + "CONCEPT_NAME" : "rucaparib", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "G0458", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "HCPCS", - "CONCEPT_CLASS_ID" : "HCPCS" + "CONCEPT_CODE" : "1862579", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 16, + "name" : "[PIONEER V2.0] Immunotherapy (sipuleucel-T & pembrolizumab)", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 2790073, - "CONCEPT_NAME" : "Contact Radiation of Prostate", + "CONCEPT_ID" : 586622, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DVY07ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP3138293", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -1368,16 +1714,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1781260, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Cesium 131 (Cs-131)", + "CONCEPT_ID" : 587503, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10B6Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP3136350", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Clinical Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -1385,16 +1731,16 @@ }, { "concept" : { - "CONCEPT_ID" : 4041984, - "CONCEPT_NAME" : "Laser ablation of prostate", + "CONCEPT_ID" : 784328, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] Box of 1 by MSD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "118164001", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "OMOP4832151", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1402,16 +1748,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789856, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Other Isotope", + "CONCEPT_ID" : 1830614, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Abacus Medicine", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10BYZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP5155867", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1419,16 +1765,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1524039, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Palladium 103 (Pd-103), Unidirectional Source", + "CONCEPT_ID" : 1832328, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by Abacus Medicine", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10BB1", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP5157569", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1436,16 +1782,16 @@ }, { "concept" : { - "CONCEPT_ID" : 37111533, - "CONCEPT_NAME" : "Ultrasonography guided transrectal cryoablation of prostate", + "CONCEPT_ID" : 21021970, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] Box of 1 by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "726544002", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "OMOP344279", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1453,16 +1799,16 @@ }, { "concept" : { - "CONCEPT_ID" : 4061656, - "CONCEPT_NAME" : "Microwave therapy to prostate", + "CONCEPT_ID" : 21090575, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "169429005", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "OMOP344278", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -1470,16 +1816,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789850, - "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Other Isotope", + "CONCEPT_ID" : 21120047, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV109YZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP344275", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -1487,16 +1833,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789851, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Cesium 137 (Cs-137)", + "CONCEPT_ID" : 21159533, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10B7Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP344277", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1504,16 +1850,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789848, - "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Palladium 103 (Pd-103)", + "CONCEPT_ID" : 35129163, + "CONCEPT_NAME" : "0.8 ML pembrolizumab 25 MG/ML Injectable Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV109BZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP4786432", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -1521,16 +1867,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789849, - "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Californium 252 (Cf-252)", + "CONCEPT_ID" : 35139888, + "CONCEPT_NAME" : "0.8 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV109CZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP4797037", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -1538,16 +1884,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789854, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Palladium 103 (Pd-103)", + "CONCEPT_ID" : 35604048, + "CONCEPT_NAME" : "sipuleucel-T Injection", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10BBZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "1726181", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -1555,16 +1901,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789855, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Californium 252 (Cf-252)", + "CONCEPT_ID" : 35604049, + "CONCEPT_NAME" : "sipuleucel-T Injection [Provenge]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10BCZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "1726183", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -1572,16 +1918,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789852, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Iridium 192 (Ir-192)", + "CONCEPT_ID" : 35604050, + "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML Injection", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10B8Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "1726185", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -1589,16 +1935,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789853, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Iodine 125 (I-125)", + "CONCEPT_ID" : 35604051, + "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML Injection [Provenge]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10B9Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "1726186", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -1606,16 +1952,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789846, - "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Iridium 192 (Ir-192)", + "CONCEPT_ID" : 35803678, + "CONCEPT_NAME" : "Pembrolizumab monotherapy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV1098Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "3199", + "DOMAIN_ID" : "Regimen", + "VOCABULARY_ID" : "HemOnc", + "CONCEPT_CLASS_ID" : "Regimen" }, "isExcluded" : false, "includeDescendants" : true, @@ -1623,16 +1969,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789847, - "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Iodine 125 (I-125)", + "CONCEPT_ID" : 36056039, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] Box of 1 by Originalis B.V.", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV1099Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP4981443", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1640,16 +1986,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789845, - "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Cesium 137 (Cs-137)", + "CONCEPT_ID" : 36056040, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by Originalis B.V.", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV1097Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP4981444", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1657,16 +2003,16 @@ }, { "concept" : { - "CONCEPT_ID" : 759648, - "CONCEPT_NAME" : "Ablation of malignant prostate tissue, transrectal, with high intensity-focused ultrasound (HIFU), including ultrasound guidance", + "CONCEPT_ID" : 36065121, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] Box of 1 by Originalis B.V.", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "55880", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "CPT4", - "CONCEPT_CLASS_ID" : "CPT4" + "CONCEPT_CODE" : "OMOP4991393", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1674,16 +2020,16 @@ }, { "concept" : { - "CONCEPT_ID" : 4073126, - "CONCEPT_NAME" : "Cryotherapy to prostate via perineal probe", + "CONCEPT_ID" : 36065122, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Originalis B.V.", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "176319004", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "OMOP4991394", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1691,16 +2037,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2110047, - "CONCEPT_NAME" : "Transperineal placement of needles or catheters into prostate for interstitial radioelement application, with or without cystoscopy", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", + "CONCEPT_ID" : 36224401, + "CONCEPT_NAME" : "sipuleucel-T Injectable Product", + "STANDARD_CONCEPT" : "C", + "STANDARD_CONCEPT_CAPTION" : "Classification", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "55875", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "CPT4", - "CONCEPT_CLASS_ID" : "CPT4" + "CONCEPT_CODE" : "1159660", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Dose Group" }, "isExcluded" : false, "includeDescendants" : true, @@ -1708,58 +2054,50 @@ }, { "concept" : { - "CONCEPT_ID" : 37111533, - "CONCEPT_NAME" : "Ultrasonography guided transrectal cryoablation of prostate", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", + "CONCEPT_ID" : 36238934, + "CONCEPT_NAME" : "Provenge Injectable Product", + "STANDARD_CONCEPT" : "C", + "STANDARD_CONCEPT_CAPTION" : "Classification", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "726544002", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "1182470", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Dose Group" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 12, - "name" : "[PIONEER 2.0] other primaries", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 432851, - "CONCEPT_NAME" : "Secondary malignant neoplastic disease", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", + "CONCEPT_ID" : 36247443, + "CONCEPT_NAME" : "pembrolizumab Injectable Product", + "STANDARD_CONCEPT" : "C", + "STANDARD_CONCEPT_CAPTION" : "Classification", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "128462008", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "1547547", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Dose Group" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 443392, - "CONCEPT_NAME" : "Malignant neoplastic disease", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", + "CONCEPT_ID" : 36247444, + "CONCEPT_NAME" : "Keytruda Injectable Product", + "STANDARD_CONCEPT" : "C", + "STANDARD_CONCEPT_CAPTION" : "Classification", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "363346000", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "1547553", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Dose Group" }, "isExcluded" : false, "includeDescendants" : true, @@ -1767,296 +2105,288 @@ }, { "concept" : { - "CONCEPT_ID" : 4112752, - "CONCEPT_NAME" : "Basal cell carcinoma of skin", + "CONCEPT_ID" : 36271591, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] by MSD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "254701007", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP3122466", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4111921, - "CONCEPT_NAME" : "Squamous cell carcinoma of skin", + "CONCEPT_ID" : 36278763, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda] by MSD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "254651007", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP3129638", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 764971, - "CONCEPT_NAME" : "Prostate cancer metastatic to eye", + "CONCEPT_ID" : 36404396, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "96901000119105", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP3096438", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36716186, - "CONCEPT_NAME" : "Hormone sensitive prostate cancer", + "CONCEPT_ID" : 36405170, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "722103009", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP3097212", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 200962, - "CONCEPT_NAME" : "Primary malignant neoplasm of prostate", + "CONCEPT_ID" : 36780945, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution [Keytruda] Box of 1 by MSD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "93974005", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4769239", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36712762, - "CONCEPT_NAME" : "Recurrent malignant neoplasm of prostate", + "CONCEPT_ID" : 36780946, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1098981000119101", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4769240", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Branded Box" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 37395835, - "CONCEPT_NAME" : "Familial prostate cancer", + "CONCEPT_ID" : 36780947, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "715412008", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4769241", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Branded Drug" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4164017, - "CONCEPT_NAME" : "Squamous cell carcinoma of prostate", + "CONCEPT_ID" : 36780948, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "399590005", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4769242", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Clinical Box" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4141960, - "CONCEPT_NAME" : "Hormone refractory prostate cancer", + "CONCEPT_ID" : 36780949, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "427492003", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4769243", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Clinical Drug" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4163261, - "CONCEPT_NAME" : "Malignant tumor of prostate", + "CONCEPT_ID" : 36787995, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "399068003", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776257", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4183913, - "CONCEPT_NAME" : "Malignant tumor involving an organ by direct extension from prostate", + "CONCEPT_ID" : 36787996, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "369598006", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776258", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4283614, - "CONCEPT_NAME" : "Malignant tumor involving bladder by direct extension from prostate", + "CONCEPT_ID" : 36787997, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "369472002", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776259", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4289246, - "CONCEPT_NAME" : "Malignant tumor involving rectum by direct extension from prostate", + "CONCEPT_ID" : 36787998, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "369451000", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776260", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4283740, - "CONCEPT_NAME" : "Malignant tumor involving seminal vesicle by direct extension from prostate", + "CONCEPT_ID" : 36787999, + "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution [Keytruda] Box of 1 by MSD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "369490001", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776261", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4280897, - "CONCEPT_NAME" : "Malignant tumor involving urethra by direct extension from prostate", + "CONCEPT_ID" : 36788000, + "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "369466002", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776262", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4289379, - "CONCEPT_NAME" : "Malignant tumor involving vasa deferentia by direct extension from prostate", + "CONCEPT_ID" : 36788001, + "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "369483006", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776263", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 13, - "name" : "[PIONEER V2.0] ADT (LHRH & anti-androgen)", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 19058410, - "CONCEPT_NAME" : "degarelix", + "CONCEPT_ID" : 36788002, + "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "475230", + "CONCEPT_CODE" : "OMOP4776264", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2064,16 +2394,16 @@ }, { "concept" : { - "CONCEPT_ID" : 739471, - "CONCEPT_NAME" : "relugolix", + "CONCEPT_ID" : 36788003, + "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "2472778", + "CONCEPT_CODE" : "OMOP4776265", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2081,16 +2411,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35834903, - "CONCEPT_NAME" : "relugolix", + "CONCEPT_ID" : 36788004, + "CONCEPT_NAME" : "pembrolizumab Intravenous Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP5040508", + "CONCEPT_CODE" : "OMOP4776266", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CLASS_ID" : "Branded Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2098,16 +2428,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1343039, - "CONCEPT_NAME" : "triptorelin", + "CONCEPT_ID" : 36788005, + "CONCEPT_NAME" : "pembrolizumab Intravenous Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "38782", + "CONCEPT_CODE" : "OMOP4776267", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2115,16 +2445,16 @@ }, { "concept" : { - "CONCEPT_ID" : 19089810, - "CONCEPT_NAME" : "gonadorelin", + "CONCEPT_ID" : 36879366, + "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "6384", + "CONCEPT_CODE" : "OMOP995343", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2132,16 +2462,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1366310, - "CONCEPT_NAME" : "goserelin", + "CONCEPT_ID" : 36880201, + "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "50610", + "CONCEPT_CODE" : "OMOP1005850", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2149,16 +2479,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1351541, - "CONCEPT_NAME" : "leuprolide", + "CONCEPT_ID" : 36885115, + "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "42375", + "CONCEPT_CODE" : "OMOP989456", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2166,16 +2496,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1344381, - "CONCEPT_NAME" : "bicalutamide", + "CONCEPT_ID" : 36889553, + "CONCEPT_NAME" : "pembrolizumab Prefilled Syringe", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "83008", + "CONCEPT_CODE" : "OMOP998887", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2183,16 +2513,16 @@ }, { "concept" : { - "CONCEPT_ID" : 19010792, - "CONCEPT_NAME" : "cyproterone", + "CONCEPT_ID" : 36889599, + "CONCEPT_NAME" : "pembrolizumab Prefilled Syringe [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "3014", + "CONCEPT_CODE" : "OMOP1005312", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2200,16 +2530,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1356461, - "CONCEPT_NAME" : "flutamide", + "CONCEPT_ID" : 36892847, + "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "4508", + "CONCEPT_CODE" : "OMOP991291", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2217,16 +2547,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1500211, - "CONCEPT_NAME" : "medroxyprogesterone", + "CONCEPT_ID" : 37592548, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] by HVD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "6691", + "CONCEPT_CODE" : "OMOP4781994", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -2234,16 +2564,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1300978, - "CONCEPT_NAME" : "megestrol", + "CONCEPT_ID" : 40224085, + "CONCEPT_NAME" : "250 ML sipuleucel-T 200000 CELLS/ML Injection [Provenge]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "6703", + "CONCEPT_CODE" : "997267", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CLASS_ID" : "Quant Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2251,16 +2581,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1315286, - "CONCEPT_NAME" : "nilutamide", + "CONCEPT_ID" : 40224086, + "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML [Provenge]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "31805", + "CONCEPT_CODE" : "997265", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CLASS_ID" : "Branded Drug Comp" }, "isExcluded" : false, "includeDescendants" : true, @@ -2268,16 +2598,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35807385, - "CONCEPT_NAME" : "GnRH agonist", - "STANDARD_CONCEPT" : "C", - "STANDARD_CONCEPT_CAPTION" : "Classification", + "CONCEPT_ID" : 40224095, + "CONCEPT_NAME" : "sipuleucel-T", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "45768", + "CONCEPT_CODE" : "997261", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "HemOnc", - "CONCEPT_CLASS_ID" : "Component Class" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -2285,41 +2615,33 @@ }, { "concept" : { - "CONCEPT_ID" : 35807349, - "CONCEPT_NAME" : "GnRH antagonist", - "STANDARD_CONCEPT" : "C", - "STANDARD_CONCEPT_CAPTION" : "Classification", + "CONCEPT_ID" : 40224096, + "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "45632", + "CONCEPT_CODE" : "997262", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "HemOnc", - "CONCEPT_CLASS_ID" : "Component Class" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Drug Comp" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 14, - "name" : "[PIONEER V2.0] ARTA", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 40239056, - "CONCEPT_NAME" : "abiraterone", + "CONCEPT_ID" : 40224097, + "CONCEPT_NAME" : "250 ML sipuleucel-T 200000 CELLS/ML Injection", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1100072", + "CONCEPT_CODE" : "997264", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CLASS_ID" : "Quant Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2327,16 +2649,16 @@ }, { "concept" : { - "CONCEPT_ID" : 963987, - "CONCEPT_NAME" : "apalutamide", + "CONCEPT_ID" : 40716385, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1999574", + "CONCEPT_CODE" : "OMOP4740730", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -2344,16 +2666,16 @@ }, { "concept" : { - "CONCEPT_ID" : 42900250, - "CONCEPT_NAME" : "enzalutamide", + "CONCEPT_ID" : 40745552, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] Box of 1 by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1307298", + "CONCEPT_CODE" : "OMOP4711640", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -2361,41 +2683,33 @@ }, { "concept" : { - "CONCEPT_ID" : 1361291, - "CONCEPT_NAME" : "darolutamide", + "CONCEPT_ID" : 40745553, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "2180325", + "CONCEPT_CODE" : "OMOP4711639", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 15, - "name" : "[PIONEER V2.0] Chemotherapy (docetaxel & cabazitaxe & paclitaxel)", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 1315942, - "CONCEPT_NAME" : "docetaxel", + "CONCEPT_ID" : 40745554, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "72962", + "CONCEPT_CODE" : "OMOP4711638", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -2403,16 +2717,16 @@ }, { "concept" : { - "CONCEPT_ID" : 40222431, - "CONCEPT_NAME" : "cabazitaxel", + "CONCEPT_ID" : 40745555, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "996051", + "CONCEPT_CODE" : "OMOP4711637", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2420,66 +2734,50 @@ }, { "concept" : { - "CONCEPT_ID" : 1378382, - "CONCEPT_NAME" : "paclitaxel", + "CONCEPT_ID" : 41079944, + "CONCEPT_NAME" : "sipuleucel-T Injectable Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "56946", + "CONCEPT_CODE" : "OMOP2277906", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 16, - "name" : "[PIONEER V2.0] Lutetium", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 44816340, - "CONCEPT_NAME" : "lutetium", + "CONCEPT_ID" : 41122672, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1534772", + "CONCEPT_CODE" : "OMOP2320634", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 17, - "name" : "[PIONEER V2.0] PARP inhibitor", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 45892579, - "CONCEPT_NAME" : "olaparib", + "CONCEPT_ID" : 41133743, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] Box of 1 by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1597582", + "CONCEPT_CODE" : "OMOP2331705", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -2487,41 +2785,33 @@ }, { "concept" : { - "CONCEPT_ID" : 1718850, - "CONCEPT_NAME" : "rucaparib", + "CONCEPT_ID" : 41271431, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1862579", + "CONCEPT_CODE" : "OMOP2469393", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 18, - "name" : "[PIONEER V2.0] Immunotherapy (sipuleucel-T & pembrolizumab)", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 586622, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection Box of 1", + "CONCEPT_ID" : 42658251, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by MSD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3138293", + "CONCEPT_CODE" : "OMOP4869815", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -2529,16 +2819,16 @@ }, { "concept" : { - "CONCEPT_ID" : 587503, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection Box of 1", + "CONCEPT_ID" : 42921578, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3136350", + "CONCEPT_CODE" : "OMOP4648403", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Clinical Box" + "CONCEPT_CLASS_ID" : "Quant Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2546,16 +2836,16 @@ }, { "concept" : { - "CONCEPT_ID" : 784328, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] Box of 1 by MSD", + "CONCEPT_ID" : 42963145, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injectable Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4832151", + "CONCEPT_CODE" : "OMOP4689628", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2563,16 +2853,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1830614, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Abacus Medicine", + "CONCEPT_ID" : 42963146, + "CONCEPT_NAME" : "pembrolizumab Injectable Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP5155867", + "CONCEPT_CODE" : "OMOP4689629", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CLASS_ID" : "Branded Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2580,13 +2870,13 @@ }, { "concept" : { - "CONCEPT_ID" : 1832328, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by Abacus Medicine", + "CONCEPT_ID" : 43173544, + "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe [Keytruda] Box of 1 by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP5157569", + "CONCEPT_CODE" : "OMOP496837", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", "CONCEPT_CLASS_ID" : "Marketed Product" @@ -2597,13 +2887,13 @@ }, { "concept" : { - "CONCEPT_ID" : 21021970, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] Box of 1 by Merck", + "CONCEPT_ID" : 44075484, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP344279", + "CONCEPT_CODE" : "OMOP1070115", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", "CONCEPT_CLASS_ID" : "Marketed Product" @@ -2614,16 +2904,16 @@ }, { "concept" : { - "CONCEPT_ID" : 21090575, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] Box of 1", + "CONCEPT_ID" : 44081458, + "CONCEPT_NAME" : "pembrolizumab Injectable Suspension", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP344278", + "CONCEPT_CODE" : "OMOP1076089", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2631,16 +2921,16 @@ }, { "concept" : { - "CONCEPT_ID" : 21120047, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection Box of 1", + "CONCEPT_ID" : 44082527, + "CONCEPT_NAME" : "pembrolizumab Injectable Suspension [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP344275", + "CONCEPT_CODE" : "OMOP1077158", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "CONCEPT_CLASS_ID" : "Branded Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2648,16 +2938,16 @@ }, { "concept" : { - "CONCEPT_ID" : 21159533, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] by Merck", + "CONCEPT_ID" : 44084103, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP344277", + "CONCEPT_CODE" : "OMOP1078734", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2665,16 +2955,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35129163, - "CONCEPT_NAME" : "0.8 ML pembrolizumab 25 MG/ML Injectable Solution", + "CONCEPT_ID" : 44124784, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4786432", + "CONCEPT_CODE" : "OMOP1119415", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Clinical Drug" + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2682,16 +2972,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35139888, - "CONCEPT_NAME" : "0.8 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda]", + "CONCEPT_ID" : 44164861, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injectable Solution Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4797037", + "CONCEPT_CODE" : "OMOP3041584", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Branded Drug" + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2699,16 +2989,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35604048, - "CONCEPT_NAME" : "sipuleucel-T Injection", + "CONCEPT_ID" : 44164862, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injectable Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1726181", + "CONCEPT_CODE" : "OMOP3041585", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2716,16 +3006,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35604049, - "CONCEPT_NAME" : "sipuleucel-T Injection [Provenge]", + "CONCEPT_ID" : 44175744, + "CONCEPT_NAME" : "pembrolizumab Injectable Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1726183", + "CONCEPT_CODE" : "OMOP3052467", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug Form" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2733,16 +3023,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35604050, - "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML Injection", + "CONCEPT_ID" : 44184353, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1726185", + "CONCEPT_CODE" : "OMOP3061076", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2750,16 +3040,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35604051, - "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML Injection [Provenge]", + "CONCEPT_ID" : 44191541, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1726186", + "CONCEPT_CODE" : "OMOP3068264", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Branded Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2767,16 +3057,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35803678, - "CONCEPT_NAME" : "Pembrolizumab monotherapy", + "CONCEPT_ID" : 44191562, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "3199", - "DOMAIN_ID" : "Regimen", - "VOCABULARY_ID" : "HemOnc", - "CONCEPT_CLASS_ID" : "Regimen" + "CONCEPT_CODE" : "OMOP3068285", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2784,16 +3074,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36056039, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] Box of 1 by Originalis B.V.", + "CONCEPT_ID" : 44191588, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4981443", + "CONCEPT_CODE" : "OMOP3068311", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CLASS_ID" : "Quant Clinical Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2801,13 +3091,13 @@ }, { "concept" : { - "CONCEPT_ID" : 36056040, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by Originalis B.V.", + "CONCEPT_ID" : 44191599, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda] Box of 1 by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4981444", + "CONCEPT_CODE" : "OMOP3068322", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", "CONCEPT_CLASS_ID" : "Marketed Product" @@ -2818,16 +3108,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36065121, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] Box of 1 by Originalis B.V.", + "CONCEPT_ID" : 45775965, + "CONCEPT_NAME" : "pembrolizumab", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4991393", + "CONCEPT_CODE" : "1547545", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -2835,16 +3125,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36065122, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Originalis B.V.", + "CONCEPT_ID" : 45775966, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4991394", + "CONCEPT_CODE" : "1547546", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Drug Comp" }, "isExcluded" : false, "includeDescendants" : true, @@ -2852,16 +3142,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36224401, - "CONCEPT_NAME" : "sipuleucel-T Injectable Product", - "STANDARD_CONCEPT" : "C", - "STANDARD_CONCEPT_CAPTION" : "Classification", + "CONCEPT_ID" : 45775970, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML [Keytruda]", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1159660", + "CONCEPT_CODE" : "1547551", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Dose Group" + "CONCEPT_CLASS_ID" : "Branded Drug Comp" }, "isExcluded" : false, "includeDescendants" : true, @@ -2869,16 +3159,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36238934, - "CONCEPT_NAME" : "Provenge Injectable Product", - "STANDARD_CONCEPT" : "C", - "STANDARD_CONCEPT_CAPTION" : "Classification", + "CONCEPT_ID" : 46276407, + "CONCEPT_NAME" : "pembrolizumab 50 MG", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1182470", + "CONCEPT_CODE" : "1657744", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Dose Group" + "CONCEPT_CLASS_ID" : "Clinical Drug Comp" }, "isExcluded" : false, "includeDescendants" : true, @@ -2886,16 +3176,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36247443, - "CONCEPT_NAME" : "pembrolizumab Injectable Product", - "STANDARD_CONCEPT" : "C", - "STANDARD_CONCEPT_CAPTION" : "Classification", + "CONCEPT_ID" : 46276408, + "CONCEPT_NAME" : "pembrolizumab Injection", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1547547", + "CONCEPT_CODE" : "1657745", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Dose Group" + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2903,16 +3193,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36247444, - "CONCEPT_NAME" : "Keytruda Injectable Product", - "STANDARD_CONCEPT" : "C", - "STANDARD_CONCEPT_CAPTION" : "Classification", + "CONCEPT_ID" : 46276409, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1547553", + "CONCEPT_CODE" : "1657746", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Dose Group" + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2920,16 +3210,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36271591, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] by MSD", + "CONCEPT_ID" : 46276410, + "CONCEPT_NAME" : "pembrolizumab 50 MG [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3122466", + "CONCEPT_CODE" : "1657747", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Drug Comp" }, "isExcluded" : false, "includeDescendants" : true, @@ -2937,16 +3227,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36278763, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda] by MSD", + "CONCEPT_ID" : 46276411, + "CONCEPT_NAME" : "pembrolizumab Injection [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3129638", + "CONCEPT_CODE" : "1657748", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2954,16 +3244,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36404396, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution Box of 1", + "CONCEPT_ID" : 46276412, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3096438", + "CONCEPT_CODE" : "1657749", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2971,16 +3261,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36405170, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution", + "CONCEPT_ID" : 46276413, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3097212", + "CONCEPT_CODE" : "1657750", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Quant Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2988,16 +3278,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36780945, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution [Keytruda] Box of 1 by MSD", + "CONCEPT_ID" : 46276414, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4769239", + "CONCEPT_CODE" : "1657751", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Quant Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -3005,16 +3295,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36780946, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution [Keytruda] Box of 1", + "CONCEPT_ID" : 46276415, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4769240", + "CONCEPT_CODE" : "1657752", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Branded Box" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -3022,33 +3312,41 @@ }, { "concept" : { - "CONCEPT_ID" : 36780947, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution [Keytruda]", + "CONCEPT_ID" : 46276416, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4769241", + "CONCEPT_CODE" : "1657753", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Branded Drug" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, - { - "concept" : { - "CONCEPT_ID" : 36780948, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution Box of 1", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", + } + ] + } + }, + { + "id" : 17, + "name" : "[PIONEER V2.0] Radium-223", + "expression" : { + "items" : [ + { + "concept" : { + "CONCEPT_ID" : 45775578, + "CONCEPT_NAME" : "radium", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4769242", + "CONCEPT_CODE" : "1546450", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Clinical Box" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -3056,16 +3354,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36780949, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution", + "CONCEPT_ID" : 902727, + "CONCEPT_NAME" : "Radium-223", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4769243", + "CONCEPT_CODE" : "OMOP5042947", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Clinical Drug" + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -3073,50 +3371,58 @@ }, { "concept" : { - "CONCEPT_ID" : 36787995, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution [Keytruda] Box of 1", + "CONCEPT_ID" : 41267222, + "CONCEPT_NAME" : "Radium Oral Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776257", + "CONCEPT_CODE" : "OMOP2465184", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, - "isExcluded" : false, - "includeDescendants" : true, + "isExcluded" : true, + "includeDescendants" : false, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36787996, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution [Keytruda]", + "CONCEPT_ID" : 43526934, + "CONCEPT_NAME" : "radium chloride Ra-223", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776258", + "CONCEPT_CODE" : "1424174", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 18, + "name" : "[PIONEER 2.0] Hx of prostate cancer", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 36787997, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution Box of 1", + "CONCEPT_ID" : 3169330, + "CONCEPT_NAME" : "Personal history of prostate cancer", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776259", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "CONCEPT_CODE" : "4220001000004104", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "Nebraska Lexicon", + "CONCEPT_CLASS_ID" : "Context-dependent" }, "isExcluded" : false, "includeDescendants" : true, @@ -3124,33 +3430,41 @@ }, { "concept" : { - "CONCEPT_ID" : 36787998, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution", + "CONCEPT_ID" : 4180749, + "CONCEPT_NAME" : "History of malignant neoplasm of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776260", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "428262008", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Context-dependent" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 19, + "name" : "[Pioneer 2.0] Local trt", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 36787999, - "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution [Keytruda] Box of 1 by MSD", + "CONCEPT_ID" : 4235738, + "CONCEPT_NAME" : "Prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776261", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "90470006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -3158,645 +3472,645 @@ }, { "concept" : { - "CONCEPT_ID" : 36788000, - "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution [Keytruda] Box of 1", + "CONCEPT_ID" : 2108677, + "CONCEPT_NAME" : "Patient counseling at a minimum on all of the following treatment options for clinically localized prostate cancer: active surveillance, and interstitial prostate brachytherapy, and external beam radiotherapy, and radical prostatectomy, provided prior to ", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776262", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CODE" : "4163F", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36788001, - "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution [Keytruda]", + "CONCEPT_ID" : 4216658, + "CONCEPT_NAME" : "Radical cystoprostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776263", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "81232004", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, - "includeDescendants" : true, + "isExcluded" : true, + "includeDescendants" : false, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36788002, - "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution Box of 1", + "CONCEPT_ID" : 4306299, + "CONCEPT_NAME" : "Excision of lesion of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776264", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "CONCEPT_CODE" : "83154001", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36788003, - "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution", + "CONCEPT_ID" : 4338661, + "CONCEPT_NAME" : "Complete transurethral resection of prostate, including control of postoperative bleeding", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776265", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "87795007", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36788004, - "CONCEPT_NAME" : "pembrolizumab Intravenous Solution [Keytruda]", + "CONCEPT_ID" : 3187777, + "CONCEPT_NAME" : "Cystoscopy with transurethral prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776266", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Form" + "CONCEPT_CODE" : "21360001000004106", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "Nebraska Lexicon", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36788005, - "CONCEPT_NAME" : "pembrolizumab Intravenous Solution", + "CONCEPT_ID" : 40487861, + "CONCEPT_NAME" : "Endoscopic excision of prostate using holmium laser", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776267", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "446445003", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36879366, - "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe [Keytruda]", + "CONCEPT_ID" : 4176312, + "CONCEPT_NAME" : "Endoscopic laser prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP995343", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "427985002", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36880201, - "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe Box of 1", + "CONCEPT_ID" : 4193061, + "CONCEPT_NAME" : "Endoscopic resection of prostate using an electrotome", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1005850", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "CONCEPT_CODE" : "314202001", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36885115, - "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe [Keytruda] Box of 1", + "CONCEPT_ID" : 2777698, + "CONCEPT_NAME" : "Excision of Prostate, Open Approach", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP989456", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CODE" : "0VB00ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36889553, - "CONCEPT_NAME" : "pembrolizumab Prefilled Syringe", + "CONCEPT_ID" : 2777697, + "CONCEPT_NAME" : "Excision of Prostate, Open Approach, Diagnostic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP998887", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "0VB00ZX", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36889599, - "CONCEPT_NAME" : "pembrolizumab Prefilled Syringe [Keytruda]", + "CONCEPT_ID" : 2777700, + "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Approach", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1005312", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Form" + "CONCEPT_CODE" : "0VB03ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36892847, - "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe", + "CONCEPT_ID" : 2777699, + "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Approach, Diagnostic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP991291", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "0VB03ZX", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 37592548, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] by HVD", + "CONCEPT_ID" : 2777702, + "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Endoscopic Approach", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4781994", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "0VB04ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40224085, - "CONCEPT_NAME" : "250 ML sipuleucel-T 200000 CELLS/ML Injection [Provenge]", + "CONCEPT_ID" : 2777701, + "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Endoscopic Approach, Diagnostic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "997267", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Quant Branded Drug" + "CONCEPT_CODE" : "0VB04ZX", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40224086, - "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML [Provenge]", + "CONCEPT_ID" : 2777704, + "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "997265", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug Comp" + "CONCEPT_CODE" : "0VB07ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40224095, - "CONCEPT_NAME" : "sipuleucel-T", + "CONCEPT_ID" : 2777703, + "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening, Diagnostic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "997261", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CODE" : "0VB07ZX", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40224096, - "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML", + "CONCEPT_ID" : 2777706, + "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening Endoscopic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "997262", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug Comp" + "CONCEPT_CODE" : "0VB08ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40224097, - "CONCEPT_NAME" : "250 ML sipuleucel-T 200000 CELLS/ML Injection", + "CONCEPT_ID" : 2777705, + "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening Endoscopic, Diagnostic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "997264", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Quant Clinical Drug" + "CONCEPT_CODE" : "0VB08ZX", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40716385, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by Merck", + "CONCEPT_ID" : 44783041, + "CONCEPT_NAME" : "Holmium laser enucleation of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4740730", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "699075006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40745552, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] Box of 1 by Merck", + "CONCEPT_ID" : 4239543, + "CONCEPT_NAME" : "One stage subtotal suprapubic prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4711640", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "91531008", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40745553, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] Box of 1", + "CONCEPT_ID" : 2003966, + "CONCEPT_NAME" : "Other transurethral prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4711639", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CODE" : "60.29", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD9Proc", + "CONCEPT_CLASS_ID" : "4-dig billing code" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40745554, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Merck", + "CONCEPT_ID" : 4021570, + "CONCEPT_NAME" : "Radical cystoprostatourethrectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4711638", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "176106009", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40745555, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda]", + "CONCEPT_ID" : 2780477, + "CONCEPT_NAME" : "Resection of Prostate, Open Approach", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4711637", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "0VT00ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 41079944, - "CONCEPT_NAME" : "sipuleucel-T Injectable Solution", + "CONCEPT_ID" : 2780478, + "CONCEPT_NAME" : "Resection of Prostate, Percutaneous Endoscopic Approach", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP2277906", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "0VT04ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 41122672, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] Box of 1", + "CONCEPT_ID" : 2780479, + "CONCEPT_NAME" : "Resection of Prostate, Via Natural or Artificial Opening", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP2320634", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CODE" : "0VT07ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 41133743, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] Box of 1 by Merck", + "CONCEPT_ID" : 2780480, + "CONCEPT_NAME" : "Resection of Prostate, Via Natural or Artificial Opening Endoscopic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP2331705", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "0VT08ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 41271431, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension Box of 1", + "CONCEPT_ID" : 4341384, + "CONCEPT_NAME" : "Salvage cystoprostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP2469393", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "CONCEPT_CODE" : "236211007", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 42658251, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by MSD", + "CONCEPT_ID" : 4341893, + "CONCEPT_NAME" : "Salvage cystoprostatourethrectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4869815", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "236209003", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 42921578, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda]", + "CONCEPT_ID" : 4212360, + "CONCEPT_NAME" : "Subtotal perineal prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4648403", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Branded Drug" + "CONCEPT_CODE" : "57525009", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 42963145, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injectable Solution [Keytruda]", + "CONCEPT_ID" : 4147673, + "CONCEPT_NAME" : "Subtotal prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4689628", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "30426000", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 42963146, - "CONCEPT_NAME" : "pembrolizumab Injectable Solution [Keytruda]", + "CONCEPT_ID" : 4078386, + "CONCEPT_NAME" : "Subtotal retropubic prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4689629", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Form" + "CONCEPT_CODE" : "19149007", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 43173544, - "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe [Keytruda] Box of 1 by Merck", + "CONCEPT_ID" : 4073700, + "CONCEPT_NAME" : "Transurethral laser prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP496837", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "176288003", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44075484, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] by Merck", + "CONCEPT_ID" : 4234536, + "CONCEPT_NAME" : "Transurethral prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1070115", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "90199006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44081458, - "CONCEPT_NAME" : "pembrolizumab Injectable Suspension", + "CONCEPT_ID" : 4287859, + "CONCEPT_NAME" : "Transurethral resection of prostate, first stage of two stages", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1076089", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "68986004", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44082527, - "CONCEPT_NAME" : "pembrolizumab Injectable Suspension [Keytruda]", + "CONCEPT_ID" : 44783043, + "CONCEPT_NAME" : "Transurethral thulium laser enucleation of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1077158", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Form" + "CONCEPT_CODE" : "699077003", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44084103, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension", + "CONCEPT_ID" : 4071791, + "CONCEPT_NAME" : "Transvesical two stage prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1078734", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "176260009", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44124784, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda]", + "CONCEPT_ID" : 4054558, + "CONCEPT_NAME" : "Two stage subtotal suprapubic prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1119415", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "21190008", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44164861, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injectable Solution Box of 1", + "CONCEPT_ID" : 4330932, + "CONCEPT_NAME" : "CT of prostate for radiotherapy planning", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3041584", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "CONCEPT_CODE" : "429856001", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -3804,16 +4118,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44164862, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injectable Solution", + "CONCEPT_ID" : 37396025, + "CONCEPT_NAME" : "CT of prostate with contrast for radiotherapy planning", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3041585", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "715687002", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -3821,16 +4135,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44175744, - "CONCEPT_NAME" : "pembrolizumab Injectable Solution", + "CONCEPT_ID" : 2108724, + "CONCEPT_NAME" : "External beam radiotherapy as primary therapy to prostate with or without nodal irradiation (PRCA)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3052467", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "4200F", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" }, "isExcluded" : false, "includeDescendants" : true, @@ -3838,16 +4152,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44184353, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection [Keytruda] Box of 1", + "CONCEPT_ID" : 2108725, + "CONCEPT_NAME" : "External beam radiotherapy with or without nodal irradiation as adjuvant or salvage therapy for prostate cancer patient (PRCA)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3061076", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CODE" : "4201F", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" }, "isExcluded" : false, "includeDescendants" : true, @@ -3855,16 +4169,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44191541, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda] Box of 1", + "CONCEPT_ID" : 4198015, + "CONCEPT_NAME" : "MRI of prostate for radiotherapy planning", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3068264", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Branded Box" + "CONCEPT_CODE" : "431850000", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -3872,16 +4186,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44191562, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution", + "CONCEPT_ID" : 43533205, + "CONCEPT_NAME" : "Low dose rate (ldr) prostate brachytherapy services, composite rate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3068285", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Clinical Drug" + "CONCEPT_CODE" : "G0458", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "HCPCS", + "CONCEPT_CLASS_ID" : "HCPCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -3889,16 +4203,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44191588, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution Box of 1", + "CONCEPT_ID" : 2790073, + "CONCEPT_NAME" : "Contact Radiation of Prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3068311", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Clinical Box" + "CONCEPT_CODE" : "DVY07ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -3906,16 +4220,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44191599, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda] Box of 1 by Merck", + "CONCEPT_ID" : 1781260, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Cesium 131 (Cs-131)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3068322", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "DV10B6Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -3923,16 +4237,16 @@ }, { "concept" : { - "CONCEPT_ID" : 45775965, - "CONCEPT_NAME" : "pembrolizumab", + "CONCEPT_ID" : 4041984, + "CONCEPT_NAME" : "Laser ablation of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1547545", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CODE" : "118164001", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -3940,16 +4254,16 @@ }, { "concept" : { - "CONCEPT_ID" : 45775966, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML", + "CONCEPT_ID" : 2789856, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Other Isotope", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1547546", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug Comp" + "CONCEPT_CODE" : "DV10BYZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -3957,16 +4271,16 @@ }, { "concept" : { - "CONCEPT_ID" : 45775970, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML [Keytruda]", + "CONCEPT_ID" : 1524039, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Palladium 103 (Pd-103), Unidirectional Source", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1547551", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug Comp" + "CONCEPT_CODE" : "DV10BB1", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -3974,16 +4288,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276407, - "CONCEPT_NAME" : "pembrolizumab 50 MG", + "CONCEPT_ID" : 37111533, + "CONCEPT_NAME" : "Ultrasonography guided transrectal cryoablation of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657744", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug Comp" + "CONCEPT_CODE" : "726544002", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -3991,16 +4305,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276408, - "CONCEPT_NAME" : "pembrolizumab Injection", + "CONCEPT_ID" : 4061656, + "CONCEPT_NAME" : "Microwave therapy to prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657745", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "169429005", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -4008,16 +4322,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276409, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection", + "CONCEPT_ID" : 2789850, + "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Other Isotope", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657746", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "DV109YZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4025,16 +4339,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276410, - "CONCEPT_NAME" : "pembrolizumab 50 MG [Keytruda]", + "CONCEPT_ID" : 2789851, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Cesium 137 (Cs-137)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657747", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug Comp" + "CONCEPT_CODE" : "DV10B7Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4042,16 +4356,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276411, - "CONCEPT_NAME" : "pembrolizumab Injection [Keytruda]", + "CONCEPT_ID" : 2789848, + "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Palladium 103 (Pd-103)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657748", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug Form" + "CONCEPT_CODE" : "DV109BZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4059,16 +4373,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276412, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda]", + "CONCEPT_ID" : 2789849, + "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Californium 252 (Cf-252)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657749", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "DV109CZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4076,16 +4390,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276413, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection", + "CONCEPT_ID" : 2789854, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Palladium 103 (Pd-103)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657750", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Quant Clinical Drug" + "CONCEPT_CODE" : "DV10BBZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4093,16 +4407,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276414, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda]", + "CONCEPT_ID" : 2789855, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Californium 252 (Cf-252)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657751", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Quant Branded Drug" + "CONCEPT_CODE" : "DV10BCZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4110,16 +4424,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276415, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection", + "CONCEPT_ID" : 2789852, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Iridium 192 (Ir-192)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657752", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "DV10B8Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4127,41 +4441,33 @@ }, { "concept" : { - "CONCEPT_ID" : 46276416, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection [Keytruda]", + "CONCEPT_ID" : 2789853, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Iodine 125 (I-125)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657753", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "DV10B9Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 19, - "name" : "[PIONEER V2.0] Radium-223", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 45775578, - "CONCEPT_NAME" : "radium", + "CONCEPT_ID" : 2789846, + "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Iridium 192 (Ir-192)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1546450", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CODE" : "DV1098Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4169,16 +4475,16 @@ }, { "concept" : { - "CONCEPT_ID" : 902727, - "CONCEPT_NAME" : "Radium-223", + "CONCEPT_ID" : 2789847, + "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Iodine 125 (I-125)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP5042947", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CODE" : "DV1099Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4186,406 +4492,651 @@ }, { "concept" : { - "CONCEPT_ID" : 41267222, - "CONCEPT_NAME" : "Radium Oral Solution", + "CONCEPT_ID" : 2789845, + "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Cesium 137 (Cs-137)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP2465184", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "DV1097Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : true, - "includeDescendants" : false, + "isExcluded" : false, + "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 43526934, - "CONCEPT_NAME" : "radium chloride Ra-223", + "CONCEPT_ID" : 759648, + "CONCEPT_NAME" : "Ablation of malignant prostate tissue, transrectal, with high intensity-focused ultrasound (HIFU), including ultrasound guidance", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1424174", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CODE" : "55880", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - } - ], - "QualifiedLimit" : { - "Type" : "First" - }, - "ExpressionLimit" : { - "Type" : "First" - }, - "InclusionRules" : [ - { - "name" : "Male", - "expression" : { - "Type" : "ALL", - "CriteriaList" : [], - "DemographicCriteriaList" : [ + }, { - "Gender" : [ - { - "CONCEPT_ID" : 8507, - "CONCEPT_NAME" : "MALE", - "STANDARD_CONCEPT" : null, - "STANDARD_CONCEPT_CAPTION" : "Unknown", - "INVALID_REASON" : null, - "INVALID_REASON_CAPTION" : "Unknown", - "CONCEPT_CODE" : "M", - "DOMAIN_ID" : "Gender", - "VOCABULARY_ID" : "Gender", - "CONCEPT_CLASS_ID" : null - } - ] - } - ], - "Groups" : [] - } - }, - { - "name" : "age 18+", - "expression" : { - "Type" : "ALL", - "CriteriaList" : [], - "DemographicCriteriaList" : [ + "concept" : { + "CONCEPT_ID" : 4073126, + "CONCEPT_NAME" : "Cryotherapy to prostate via perineal probe", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176319004", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, { - "Age" : { - "Value" : 18, - "Op" : "gte" - } - } - ], - "Groups" : [] - } - }, - { - "name" : "metastasis", - "expression" : { - "Type" : "ALL", - "CriteriaList" : [], - "DemographicCriteriaList" : [], - "Groups" : [ + "concept" : { + "CONCEPT_ID" : 2110047, + "CONCEPT_NAME" : "Transperineal placement of needles or catheters into prostate for interstitial radioelement application, with or without cystoscopy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "55875", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, { - "Type" : "ANY", + "concept" : { + "CONCEPT_ID" : 37111533, + "CONCEPT_NAME" : "Ultrasonography guided transrectal cryoablation of prostate", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "726544002", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2110046, + "CONCEPT_NAME" : "Cryosurgical ablation of the prostate (includes ultrasonic guidance and monitoring)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "55873", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2110035, + "CONCEPT_NAME" : "Prostatectomy (including control of postoperative bleeding, vasectomy, meatotomy, urethral calibration and/or dilation, and internal urethrotomy); suprapubic, subtotal, 1 or 2 stages", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "55821", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2108678, + "CONCEPT_NAME" : "Adjuvant (ie, in combination with external beam radiotherapy to the prostate for prostate cancer) hormonal therapy (gonadotropin-releasing hormone [GnRH] agonist or antagonist) prescribed/administered (PRCA)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "4164F", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2101059, + "CONCEPT_NAME" : "Anesthesia for; perineal prostatectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "00908", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2777698, + "CONCEPT_NAME" : "Excision of Prostate, Open Approach", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "0VB00ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 40490346, + "CONCEPT_NAME" : "Transrectal high intensity focused ultrasound ablation of prostate", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "446941000", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2110043, + "CONCEPT_NAME" : "Exposure of prostate, any approach, for insertion of radioactive substance; with bilateral pelvic lymphadenectomy, including external iliac, hypogastric and obturator nodes", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "55865", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2789830, + "CONCEPT_NAME" : "Beam Radiation of Prostate using Photons >10 MeV", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "DV002ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 709928, + "CONCEPT_NAME" : "Transurethral ablation of malignant prostate tissue by high-energy water vapor thermotherapy, including intraoperative imaging and needle guidance", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "0582T", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 42733763, + "CONCEPT_NAME" : "Transurethral resection of prostate; first stage of two-stage resection (partial resection) (Deprecated)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "52612", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 42733764, + "CONCEPT_NAME" : "Transurethral resection of prostate; second stage of two-stage resection (resection completed) (Deprecated)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "52614", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + } + ] + } + } + ], + "QualifiedLimit" : { + "Type" : "First" + }, + "ExpressionLimit" : { + "Type" : "All" + }, + "InclusionRules" : [ + { + "name" : "Male", + "expression" : { + "Type" : "ALL", + "CriteriaList" : [], + "DemographicCriteriaList" : [ + { + "Gender" : [ + { + "CONCEPT_ID" : 8507, + "CONCEPT_NAME" : "MALE", + "STANDARD_CONCEPT" : null, + "STANDARD_CONCEPT_CAPTION" : "Unknown", + "INVALID_REASON" : null, + "INVALID_REASON_CAPTION" : "Unknown", + "CONCEPT_CODE" : "M", + "DOMAIN_ID" : "Gender", + "VOCABULARY_ID" : "Gender", + "CONCEPT_CLASS_ID" : null + } + ] + } + ], + "Groups" : [] + } + }, + { + "name" : "age 18+", + "expression" : { + "Type" : "ALL", + "CriteriaList" : [], + "DemographicCriteriaList" : [ + { + "Age" : { + "Value" : 18, + "Op" : "gte" + } + } + ], + "Groups" : [] + } + }, + { + "name" : "no other drugs", + "expression" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 14, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 15, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 16, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 17, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 12, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + }, + { + "name" : "No other primary", + "expression" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "ConditionOccurrence" : { + "CodesetId" : 10, + "ConditionTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "Observation" : { + "CodesetId" : 10, + "ObservationTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + }, + { + "name" : "metastasis", + "expression" : { + "Type" : "ANY", + "CriteriaList" : [], + "DemographicCriteriaList" : [], + "Groups" : [ + { + "Type" : "AT_LEAST", + "Count" : 1, "CriteriaList" : [ { "Criteria" : { "ConditionOccurrence" : { "CorrelatedCriteria" : { "Type" : "ALL", - "CriteriaList" : [], - "DemographicCriteriaList" : [], - "Groups" : [ + "CriteriaList" : [ { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "ConditionOccurrence" : { - "CodesetId" : 2, - "ConditionTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 30, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } + "Criteria" : { + "ConditionOccurrence" : { + "CodesetId" : 2, + "ConditionTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 }, - { - "Criteria" : { - "ProcedureOccurrence" : { - "CodesetId" : 4, - "ProcedureTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 1, - "Coeff" : -1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } + "End" : { + "Days" : 30, + "Coeff" : 1 }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 183, - "Coeff" : -1 - }, - "End" : { - "Days" : 1, - "Coeff" : -1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } }, { - "Type" : "ANY", - "CriteriaList" : [ - { - "Criteria" : { - "ProcedureOccurrence" : { - "CodesetId" : 11, - "ProcedureTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 184, - "Coeff" : -1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "Observation" : { - "CodesetId" : 11, - "ObservationTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 184, - "Coeff" : -1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 11, + "DrugTypeExclude" : false } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - }, - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } + "End" : { + "Days" : 1, + "Coeff" : -1 }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "ProcedureOccurrence" : { + "CodesetId" : 4, + "ProcedureTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 18, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } + "End" : { + "Days" : 1, + "Coeff" : -1 }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [ + { + "Type" : "ANY", + "CriteriaList" : [ { "Criteria" : { - "DrugExposure" : { + "Observation" : { "CodesetId" : 19, - "DrugTypeExclude" : false + "ObservationTypeExclude" : false } }, "StartWindow" : { "Start" : { - "Days" : 0, "Coeff" : -1 }, "End" : { - "Days" : 183, - "Coeff" : 1 + "Days" : 184, + "Coeff" : -1 }, "UseIndexEnd" : false, "UseEventEnd" : false @@ -4593,26 +5144,25 @@ "RestrictVisit" : false, "IgnoreObservationPeriod" : false, "Occurrence" : { - "Type" : 0, - "Count" : 0, + "Type" : 2, + "Count" : 1, "IsDistinct" : false } }, { "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false + "ProcedureOccurrence" : { + "CodesetId" : 19, + "ProcedureTypeExclude" : false } }, "StartWindow" : { "Start" : { - "Days" : 0, "Coeff" : -1 }, "End" : { - "Days" : 183, - "Coeff" : 1 + "Days" : 184, + "Coeff" : -1 }, "UseIndexEnd" : false, "UseEventEnd" : false @@ -4671,7 +5221,6 @@ }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -4691,9 +5240,9 @@ }, { "Criteria" : { - "ProcedureOccurrence" : { - "CodesetId" : 4, - "ProcedureTypeExclude" : false + "DrugExposure" : { + "CodesetId" : 11, + "DrugTypeExclude" : false } }, "StartWindow" : { @@ -4717,14 +5266,13 @@ }, { "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false + "ProcedureOccurrence" : { + "CodesetId" : 4, + "ProcedureTypeExclude" : false } }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -4751,7 +5299,7 @@ { "Criteria" : { "Observation" : { - "CodesetId" : 11, + "CodesetId" : 19, "ObservationTypeExclude" : false } }, @@ -4777,7 +5325,7 @@ { "Criteria" : { "ProcedureOccurrence" : { - "CodesetId" : 11, + "CodesetId" : 19, "ProcedureTypeExclude" : false } }, @@ -4803,208 +5351,62 @@ ], "DemographicCriteriaList" : [], "Groups" : [] - }, - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 18, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 19, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] } ] }, - "CodesetId" : 6, + "CodesetId" : 7, "First" : true, - "MeasurementTypeExclude" : false + "MeasurementTypeExclude" : false, + "ValueAsConcept" : [ + { + "CONCEPT_ID" : 45878386, + "CONCEPT_NAME" : "M1C", + "STANDARD_CONCEPT" : null, + "STANDARD_CONCEPT_CAPTION" : "Unknown", + "INVALID_REASON" : null, + "INVALID_REASON_CAPTION" : "Unknown", + "CONCEPT_CODE" : "LA4625-5", + "DOMAIN_ID" : "Meas Value", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : null + }, + { + "CONCEPT_ID" : 45881618, + "CONCEPT_NAME" : "M1B", + "STANDARD_CONCEPT" : null, + "STANDARD_CONCEPT_CAPTION" : "Unknown", + "INVALID_REASON" : null, + "INVALID_REASON_CAPTION" : "Unknown", + "CONCEPT_CODE" : "LA4626-3", + "DOMAIN_ID" : "Meas Value", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : null + }, + { + "CONCEPT_ID" : 45882500, + "CONCEPT_NAME" : "M1A", + "STANDARD_CONCEPT" : null, + "STANDARD_CONCEPT_CAPTION" : "Unknown", + "INVALID_REASON" : null, + "INVALID_REASON_CAPTION" : "Unknown", + "CONCEPT_CODE" : "LA4627-1", + "DOMAIN_ID" : "Meas Value", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : null + }, + { + "CONCEPT_ID" : 45876322, + "CONCEPT_NAME" : "M1", + "STANDARD_CONCEPT" : null, + "STANDARD_CONCEPT_CAPTION" : "Unknown", + "INVALID_REASON" : null, + "INVALID_REASON_CAPTION" : "Unknown", + "CONCEPT_CODE" : "LA4628-9", + "DOMAIN_ID" : "Meas Value", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : null + } + ] } }, "StartWindow" : { @@ -5042,7 +5444,6 @@ }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -5062,9 +5463,9 @@ }, { "Criteria" : { - "ProcedureOccurrence" : { - "CodesetId" : 4, - "ProcedureTypeExclude" : false + "DrugExposure" : { + "CodesetId" : 11, + "DrugTypeExclude" : false } }, "StartWindow" : { @@ -5088,14 +5489,13 @@ }, { "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false + "ProcedureOccurrence" : { + "CodesetId" : 4, + "ProcedureTypeExclude" : false } }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -5119,36 +5519,10 @@ { "Type" : "ANY", "CriteriaList" : [ - { - "Criteria" : { - "ProcedureOccurrence" : { - "CodesetId" : 11, - "ProcedureTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 184, - "Coeff" : -1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, { "Criteria" : { "Observation" : { - "CodesetId" : 11, + "CodesetId" : 19, "ObservationTypeExclude" : false } }, @@ -5170,192 +5544,22 @@ "Count" : 1, "IsDistinct" : false } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - }, - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 18, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } }, { "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { + "ProcedureOccurrence" : { "CodesetId" : 19, - "DrugTypeExclude" : false + "ProcedureTypeExclude" : false } }, "StartWindow" : { "Start" : { - "Days" : 0, "Coeff" : -1 }, "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, + "Days" : 184, "Coeff" : -1 }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, "UseIndexEnd" : false, "UseEventEnd" : false }, @@ -5373,59 +5577,9 @@ } ] }, - "CodesetId" : 9, + "CodesetId" : 6, "First" : true, - "MeasurementTypeExclude" : false, - "ValueAsConcept" : [ - { - "CONCEPT_ID" : 45878386, - "CONCEPT_NAME" : "M1C", - "STANDARD_CONCEPT" : null, - "STANDARD_CONCEPT_CAPTION" : "Unknown", - "INVALID_REASON" : null, - "INVALID_REASON_CAPTION" : "Unknown", - "CONCEPT_CODE" : "LA4625-5", - "DOMAIN_ID" : "Meas Value", - "VOCABULARY_ID" : "LOINC", - "CONCEPT_CLASS_ID" : null - }, - { - "CONCEPT_ID" : 45881618, - "CONCEPT_NAME" : "M1B", - "STANDARD_CONCEPT" : null, - "STANDARD_CONCEPT_CAPTION" : "Unknown", - "INVALID_REASON" : null, - "INVALID_REASON_CAPTION" : "Unknown", - "CONCEPT_CODE" : "LA4626-3", - "DOMAIN_ID" : "Meas Value", - "VOCABULARY_ID" : "LOINC", - "CONCEPT_CLASS_ID" : null - }, - { - "CONCEPT_ID" : 45882500, - "CONCEPT_NAME" : "M1A", - "STANDARD_CONCEPT" : null, - "STANDARD_CONCEPT_CAPTION" : "Unknown", - "INVALID_REASON" : null, - "INVALID_REASON_CAPTION" : "Unknown", - "CONCEPT_CODE" : "LA4627-1", - "DOMAIN_ID" : "Meas Value", - "VOCABULARY_ID" : "LOINC", - "CONCEPT_CLASS_ID" : null - }, - { - "CONCEPT_ID" : 45876322, - "CONCEPT_NAME" : "M1", - "STANDARD_CONCEPT" : null, - "STANDARD_CONCEPT_CAPTION" : "Unknown", - "INVALID_REASON" : null, - "INVALID_REASON_CAPTION" : "Unknown", - "CONCEPT_CODE" : "LA4628-9", - "DOMAIN_ID" : "Meas Value", - "VOCABULARY_ID" : "LOINC", - "CONCEPT_CLASS_ID" : null - } - ] + "MeasurementTypeExclude" : false } }, "StartWindow" : { @@ -5454,48 +5608,12 @@ } ] } - }, - { - "name" : "no other primary", - "expression" : { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "ConditionOccurrence" : { - "CodesetId" : 12, - "ConditionTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 30, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } } ], "CensoringCriteria" : [ { "ConditionOccurrence" : { - "CodesetId" : 12, + "CodesetId" : 10, "ConditionTypeExclude" : false } } diff --git a/inst/cohorts/117.json b/inst/cohorts/117.json index 3fbd916..9105a73 100644 --- a/inst/cohorts/117.json +++ b/inst/cohorts/117.json @@ -4,7 +4,41 @@ "CriteriaList" : [ { "DrugExposure" : { - "CodesetId" : 13, + "CorrelatedCriteria" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 12, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + }, + "CodesetId" : 11, "OccurrenceStartDate" : { "Value" : "2016-01-01", "Op" : "bt", @@ -15,8 +49,41 @@ }, { "ProcedureOccurrence" : { + "CorrelatedCriteria" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 12, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + }, "CodesetId" : 4, - "First" : true, "OccurrenceStartDate" : { "Value" : "2016-01-01", "Op" : "bt", @@ -27,7 +94,68 @@ }, { "DrugExposure" : { - "CodesetId" : 14, + "CorrelatedCriteria" : { + "Type" : "ANY", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 11, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "ProcedureOccurrence" : { + "CodesetId" : 4, + "ProcedureTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + }, + "CodesetId" : 12, "OccurrenceStartDate" : { "Value" : "2016-01-01", "Op" : "bt", @@ -42,7 +170,7 @@ "PostDays" : 0 }, "PrimaryCriteriaLimit" : { - "Type" : "All" + "Type" : "First" } }, "ConceptSets" : [ @@ -101,6 +229,74 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264861, + "CONCEPT_NAME" : "pM1c: Distant metastasis site other than bone or non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397215009", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264288, + "CONCEPT_NAME" : "pM1b: Distant metastasis to bone(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397214008", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4246703, + "CONCEPT_NAME" : "pM1a: Distant metastasis to non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397213002", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 763131, + "CONCEPT_NAME" : "Neoplasm of prostate distant metastasis staging category M1: Distant metastasis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "436401000124103", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false } ] } @@ -188,13 +384,47 @@ }, { "concept" : { - "CONCEPT_ID" : 4145907, - "CONCEPT_NAME" : "Orchiectomy of remaining testis", + "CONCEPT_ID" : 4304921, + "CONCEPT_NAME" : "Bilateral orchidectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "34426006", + "CONCEPT_CODE" : "386634006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4073142, + "CONCEPT_NAME" : "Bilateral total orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176416007", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4073143, + "CONCEPT_NAME" : "Bilateral total scrotal orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176418008", "DOMAIN_ID" : "Procedure", "VOCABULARY_ID" : "SNOMED", "CONCEPT_CLASS_ID" : "Procedure" @@ -220,6 +450,57 @@ "includeDescendants" : true, "includeMapped" : false }, + { + "concept" : { + "CONCEPT_ID" : 4012324, + "CONCEPT_NAME" : "Bilateral cryptorchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "112910006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4073141, + "CONCEPT_NAME" : "Bilateral subcapsular orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176415006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4071936, + "CONCEPT_NAME" : "Bilateral total inguinal orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176417003", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, { "concept" : { "CONCEPT_ID" : 35608156, @@ -511,25 +792,42 @@ }, { "concept" : { - "CONCEPT_ID" : 4012324, - "CONCEPT_NAME" : "Bilateral cryptorchidectomy", + "CONCEPT_ID" : 4341536, + "CONCEPT_NAME" : "Total orchidectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "112910006", + "CONCEPT_CODE" : "236334001", "DOMAIN_ID" : "Procedure", "VOCABULARY_ID" : "SNOMED", "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { + }, + { + "concept" : { + "CONCEPT_ID" : 4145907, + "CONCEPT_NAME" : "Orchiectomy of remaining testis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "34426006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + } + ] + } + }, + { "id" : 6, "name" : "[PIONEER 2.0] Cancer Modifier Metastasis", "expression" : { @@ -572,7 +870,7 @@ } }, { - "id" : 9, + "id" : 7, "name" : "[PIONEER 2.0] Metastasis measurement require value", "expression" : { "items" : [ @@ -597,39 +895,22 @@ } }, { - "id" : 11, - "name" : "[Pioneer 2.0] Local trt", + "id" : 10, + "name" : "[PIONEER 2.0] other primaries", "expression" : { "items" : [ { "concept" : { - "CONCEPT_ID" : 4235738, - "CONCEPT_NAME" : "Prostatectomy", + "CONCEPT_ID" : 432851, + "CONCEPT_NAME" : "Secondary malignant neoplastic disease", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "90470006", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "128462008", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" - }, - "isExcluded" : false, - "includeDescendants" : true, - "includeMapped" : false - }, - { - "concept" : { - "CONCEPT_ID" : 2108677, - "CONCEPT_NAME" : "Patient counseling at a minimum on all of the following treatment options for clinically localized prostate cancer: active surveillance, and interstitial prostate brachytherapy, and external beam radiotherapy, and radical prostatectomy, provided prior to ", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", - "INVALID_REASON" : "V", - "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "4163F", - "DOMAIN_ID" : "Observation", - "VOCABULARY_ID" : "CPT4", - "CONCEPT_CLASS_ID" : "CPT4" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -637,33 +918,33 @@ }, { "concept" : { - "CONCEPT_ID" : 4216658, - "CONCEPT_NAME" : "Radical cystoprostatectomy", + "CONCEPT_ID" : 443392, + "CONCEPT_NAME" : "Malignant neoplastic disease", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "81232004", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "363346000", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, - "isExcluded" : true, - "includeDescendants" : false, + "isExcluded" : false, + "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4306299, - "CONCEPT_NAME" : "Excision of lesion of prostate", + "CONCEPT_ID" : 4112752, + "CONCEPT_NAME" : "Basal cell carcinoma of skin", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "83154001", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "254701007", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -671,16 +952,16 @@ }, { "concept" : { - "CONCEPT_ID" : 4338661, - "CONCEPT_NAME" : "Complete transurethral resection of prostate, including control of postoperative bleeding", + "CONCEPT_ID" : 4111921, + "CONCEPT_NAME" : "Squamous cell carcinoma of skin", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "87795007", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "254651007", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -688,16 +969,16 @@ }, { "concept" : { - "CONCEPT_ID" : 3187777, - "CONCEPT_NAME" : "Cystoscopy with transurethral prostatectomy", + "CONCEPT_ID" : 764971, + "CONCEPT_NAME" : "Prostate cancer metastatic to eye", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "21360001000004106", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "Nebraska Lexicon", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "96901000119105", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -705,16 +986,16 @@ }, { "concept" : { - "CONCEPT_ID" : 40487861, - "CONCEPT_NAME" : "Endoscopic excision of prostate using holmium laser", + "CONCEPT_ID" : 36716186, + "CONCEPT_NAME" : "Hormone sensitive prostate cancer", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "446445003", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "722103009", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -722,16 +1003,16 @@ }, { "concept" : { - "CONCEPT_ID" : 4176312, - "CONCEPT_NAME" : "Endoscopic laser prostatectomy", + "CONCEPT_ID" : 200962, + "CONCEPT_NAME" : "Primary malignant neoplasm of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "427985002", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "93974005", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -739,16 +1020,16 @@ }, { "concept" : { - "CONCEPT_ID" : 4193061, - "CONCEPT_NAME" : "Endoscopic resection of prostate using an electrotome", + "CONCEPT_ID" : 36712762, + "CONCEPT_NAME" : "Recurrent malignant neoplasm of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "314202001", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "1098981000119101", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -756,16 +1037,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777698, - "CONCEPT_NAME" : "Excision of Prostate, Open Approach", + "CONCEPT_ID" : 37395835, + "CONCEPT_NAME" : "Familial prostate cancer", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB00ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "715412008", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -773,16 +1054,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777697, - "CONCEPT_NAME" : "Excision of Prostate, Open Approach, Diagnostic", + "CONCEPT_ID" : 4164017, + "CONCEPT_NAME" : "Squamous cell carcinoma of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB00ZX", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "399590005", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -790,16 +1071,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777700, - "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Approach", + "CONCEPT_ID" : 4141960, + "CONCEPT_NAME" : "Hormone refractory prostate cancer", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB03ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "427492003", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -807,16 +1088,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777699, - "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Approach, Diagnostic", + "CONCEPT_ID" : 4163261, + "CONCEPT_NAME" : "Malignant tumor of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB03ZX", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "399068003", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -824,16 +1105,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777702, - "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Endoscopic Approach", + "CONCEPT_ID" : 4183913, + "CONCEPT_NAME" : "Malignant tumor involving an organ by direct extension from prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB04ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "369598006", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -841,16 +1122,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777701, - "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Endoscopic Approach, Diagnostic", + "CONCEPT_ID" : 4283614, + "CONCEPT_NAME" : "Malignant tumor involving bladder by direct extension from prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB04ZX", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "369472002", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -858,16 +1139,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777704, - "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening", + "CONCEPT_ID" : 4289246, + "CONCEPT_NAME" : "Malignant tumor involving rectum by direct extension from prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB07ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "369451000", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -875,16 +1156,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777703, - "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening, Diagnostic", + "CONCEPT_ID" : 4283740, + "CONCEPT_NAME" : "Malignant tumor involving seminal vesicle by direct extension from prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB07ZX", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "369490001", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -892,16 +1173,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777706, - "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening Endoscopic", + "CONCEPT_ID" : 4280897, + "CONCEPT_NAME" : "Malignant tumor involving urethra by direct extension from prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB08ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "369466002", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -909,16 +1190,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777705, - "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening Endoscopic, Diagnostic", + "CONCEPT_ID" : 4289379, + "CONCEPT_NAME" : "Malignant tumor involving vasa deferentia by direct extension from prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB08ZX", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "369483006", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -926,356 +1207,380 @@ }, { "concept" : { - "CONCEPT_ID" : 44783041, - "CONCEPT_NAME" : "Holmium laser enucleation of prostate", + "CONCEPT_ID" : 4312326, + "CONCEPT_NAME" : "Neoplasm, malignant (primary)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "699075006", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "86049000", + "DOMAIN_ID" : "Observation", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Morph Abnormality" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 11, + "name" : "[PIONEER V2.0] ADT (LHRH & anti-androgen)", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 4239543, - "CONCEPT_NAME" : "One stage subtotal suprapubic prostatectomy", + "CONCEPT_ID" : 19058410, + "CONCEPT_NAME" : "degarelix", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "91531008", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "475230", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 2003966, - "CONCEPT_NAME" : "Other transurethral prostatectomy", + "CONCEPT_ID" : 739471, + "CONCEPT_NAME" : "relugolix", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "60.29", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD9Proc", - "CONCEPT_CLASS_ID" : "4-dig billing code" + "CONCEPT_CODE" : "2472778", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4021570, - "CONCEPT_NAME" : "Radical cystoprostatourethrectomy", + "CONCEPT_ID" : 35834903, + "CONCEPT_NAME" : "relugolix", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "176106009", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "OMOP5040508", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 2780477, - "CONCEPT_NAME" : "Resection of Prostate, Open Approach", + "CONCEPT_ID" : 1343039, + "CONCEPT_NAME" : "triptorelin", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VT00ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "38782", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 2780478, - "CONCEPT_NAME" : "Resection of Prostate, Percutaneous Endoscopic Approach", + "CONCEPT_ID" : 19089810, + "CONCEPT_NAME" : "gonadorelin", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VT04ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "6384", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 2780479, - "CONCEPT_NAME" : "Resection of Prostate, Via Natural or Artificial Opening", + "CONCEPT_ID" : 1366310, + "CONCEPT_NAME" : "goserelin", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VT07ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "50610", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 2780480, - "CONCEPT_NAME" : "Resection of Prostate, Via Natural or Artificial Opening Endoscopic", + "CONCEPT_ID" : 1351541, + "CONCEPT_NAME" : "leuprolide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VT08ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "42375", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4341384, - "CONCEPT_NAME" : "Salvage cystoprostatectomy", + "CONCEPT_ID" : 1344381, + "CONCEPT_NAME" : "bicalutamide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "236211007", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "83008", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4341893, - "CONCEPT_NAME" : "Salvage cystoprostatourethrectomy", + "CONCEPT_ID" : 19010792, + "CONCEPT_NAME" : "cyproterone", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "236209003", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "3014", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4212360, - "CONCEPT_NAME" : "Subtotal perineal prostatectomy", + "CONCEPT_ID" : 1356461, + "CONCEPT_NAME" : "flutamide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "57525009", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "4508", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4147673, - "CONCEPT_NAME" : "Subtotal prostatectomy", + "CONCEPT_ID" : 1500211, + "CONCEPT_NAME" : "medroxyprogesterone", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "30426000", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "6691", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4078386, - "CONCEPT_NAME" : "Subtotal retropubic prostatectomy", + "CONCEPT_ID" : 1300978, + "CONCEPT_NAME" : "megestrol", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "19149007", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "6703", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4073700, - "CONCEPT_NAME" : "Transurethral laser prostatectomy", + "CONCEPT_ID" : 1315286, + "CONCEPT_NAME" : "nilutamide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "176288003", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "31805", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4234536, - "CONCEPT_NAME" : "Transurethral prostatectomy", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", + "CONCEPT_ID" : 35807385, + "CONCEPT_NAME" : "GnRH agonist", + "STANDARD_CONCEPT" : "C", + "STANDARD_CONCEPT_CAPTION" : "Classification", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "90199006", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "45768", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "HemOnc", + "CONCEPT_CLASS_ID" : "Component Class" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4287859, - "CONCEPT_NAME" : "Transurethral resection of prostate, first stage of two stages", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", + "CONCEPT_ID" : 35807349, + "CONCEPT_NAME" : "GnRH antagonist", + "STANDARD_CONCEPT" : "C", + "STANDARD_CONCEPT_CAPTION" : "Classification", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "68986004", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "45632", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "HemOnc", + "CONCEPT_CLASS_ID" : "Component Class" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 12, + "name" : "[PIONEER V2.0] ARTA", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 44783043, - "CONCEPT_NAME" : "Transurethral thulium laser enucleation of prostate", + "CONCEPT_ID" : 40239056, + "CONCEPT_NAME" : "abiraterone", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "699077003", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "1100072", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4071791, - "CONCEPT_NAME" : "Transvesical two stage prostatectomy", + "CONCEPT_ID" : 963987, + "CONCEPT_NAME" : "apalutamide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "176260009", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "1999574", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4054558, - "CONCEPT_NAME" : "Two stage subtotal suprapubic prostatectomy", + "CONCEPT_ID" : 42900250, + "CONCEPT_NAME" : "enzalutamide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "21190008", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "1307298", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4330932, - "CONCEPT_NAME" : "CT of prostate for radiotherapy planning", + "CONCEPT_ID" : 1361291, + "CONCEPT_NAME" : "darolutamide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "429856001", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "2180325", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 13, + "name" : "[PIONEER V2.0] Chemotherapy (docetaxel & cabazitaxe & paclitaxel)", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 37396025, - "CONCEPT_NAME" : "CT of prostate with contrast for radiotherapy planning", + "CONCEPT_ID" : 1315942, + "CONCEPT_NAME" : "docetaxel", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "715687002", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "72962", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -1283,16 +1588,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2108724, - "CONCEPT_NAME" : "External beam radiotherapy as primary therapy to prostate with or without nodal irradiation (PRCA)", + "CONCEPT_ID" : 40222431, + "CONCEPT_NAME" : "cabazitaxel", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "4200F", - "DOMAIN_ID" : "Observation", - "VOCABULARY_ID" : "CPT4", - "CONCEPT_CLASS_ID" : "CPT4" + "CONCEPT_CODE" : "996051", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -1300,50 +1605,66 @@ }, { "concept" : { - "CONCEPT_ID" : 2108725, - "CONCEPT_NAME" : "External beam radiotherapy with or without nodal irradiation as adjuvant or salvage therapy for prostate cancer patient (PRCA)", + "CONCEPT_ID" : 1378382, + "CONCEPT_NAME" : "paclitaxel", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "4201F", - "DOMAIN_ID" : "Observation", - "VOCABULARY_ID" : "CPT4", - "CONCEPT_CLASS_ID" : "CPT4" + "CONCEPT_CODE" : "56946", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 14, + "name" : "[PIONEER V2.0] Lutetium", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 4198015, - "CONCEPT_NAME" : "MRI of prostate for radiotherapy planning", + "CONCEPT_ID" : 44816340, + "CONCEPT_NAME" : "lutetium", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "431850000", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "1534772", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 15, + "name" : "[PIONEER V2.0] PARP inhibitor", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 43533205, - "CONCEPT_NAME" : "Low dose rate (ldr) prostate brachytherapy services, composite rate", + "CONCEPT_ID" : 45892579, + "CONCEPT_NAME" : "olaparib", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "G0458", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "HCPCS", - "CONCEPT_CLASS_ID" : "HCPCS" + "CONCEPT_CODE" : "1597582", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -1351,33 +1672,41 @@ }, { "concept" : { - "CONCEPT_ID" : 2790073, - "CONCEPT_NAME" : "Contact Radiation of Prostate", + "CONCEPT_ID" : 1718850, + "CONCEPT_NAME" : "rucaparib", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DVY07ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "1862579", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 16, + "name" : "[PIONEER V2.0] Immunotherapy (sipuleucel-T & pembrolizumab)", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 1781260, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Cesium 131 (Cs-131)", + "CONCEPT_ID" : 586622, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10B6Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP3138293", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -1385,16 +1714,16 @@ }, { "concept" : { - "CONCEPT_ID" : 4041984, - "CONCEPT_NAME" : "Laser ablation of prostate", + "CONCEPT_ID" : 587503, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "118164001", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "OMOP3136350", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Clinical Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -1402,16 +1731,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789856, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Other Isotope", + "CONCEPT_ID" : 784328, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] Box of 1 by MSD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10BYZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP4832151", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1419,16 +1748,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1524039, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Palladium 103 (Pd-103), Unidirectional Source", + "CONCEPT_ID" : 1830614, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Abacus Medicine", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10BB1", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP5155867", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1436,16 +1765,16 @@ }, { "concept" : { - "CONCEPT_ID" : 37111533, - "CONCEPT_NAME" : "Ultrasonography guided transrectal cryoablation of prostate", + "CONCEPT_ID" : 1832328, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by Abacus Medicine", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "726544002", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "OMOP5157569", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1453,16 +1782,16 @@ }, { "concept" : { - "CONCEPT_ID" : 4061656, - "CONCEPT_NAME" : "Microwave therapy to prostate", + "CONCEPT_ID" : 21021970, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] Box of 1 by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "169429005", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "OMOP344279", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1470,16 +1799,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789850, - "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Other Isotope", + "CONCEPT_ID" : 21090575, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV109YZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP344278", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -1487,16 +1816,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789851, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Cesium 137 (Cs-137)", + "CONCEPT_ID" : 21120047, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10B7Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP344275", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -1504,16 +1833,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789848, - "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Palladium 103 (Pd-103)", + "CONCEPT_ID" : 21159533, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV109BZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP344277", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1521,16 +1850,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789849, - "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Californium 252 (Cf-252)", + "CONCEPT_ID" : 35129163, + "CONCEPT_NAME" : "0.8 ML pembrolizumab 25 MG/ML Injectable Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV109CZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP4786432", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -1538,16 +1867,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789854, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Palladium 103 (Pd-103)", + "CONCEPT_ID" : 35139888, + "CONCEPT_NAME" : "0.8 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10BBZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP4797037", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -1555,16 +1884,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789855, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Californium 252 (Cf-252)", + "CONCEPT_ID" : 35604048, + "CONCEPT_NAME" : "sipuleucel-T Injection", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10BCZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "1726181", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -1572,16 +1901,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789852, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Iridium 192 (Ir-192)", + "CONCEPT_ID" : 35604049, + "CONCEPT_NAME" : "sipuleucel-T Injection [Provenge]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10B8Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "1726183", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -1589,16 +1918,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789853, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Iodine 125 (I-125)", + "CONCEPT_ID" : 35604050, + "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML Injection", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10B9Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "1726185", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -1606,16 +1935,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789846, - "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Iridium 192 (Ir-192)", + "CONCEPT_ID" : 35604051, + "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML Injection [Provenge]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV1098Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "1726186", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -1623,16 +1952,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789847, - "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Iodine 125 (I-125)", + "CONCEPT_ID" : 35803678, + "CONCEPT_NAME" : "Pembrolizumab monotherapy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV1099Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "3199", + "DOMAIN_ID" : "Regimen", + "VOCABULARY_ID" : "HemOnc", + "CONCEPT_CLASS_ID" : "Regimen" }, "isExcluded" : false, "includeDescendants" : true, @@ -1640,16 +1969,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789845, - "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Cesium 137 (Cs-137)", + "CONCEPT_ID" : 36056039, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] Box of 1 by Originalis B.V.", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV1097Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP4981443", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1657,16 +1986,16 @@ }, { "concept" : { - "CONCEPT_ID" : 759648, - "CONCEPT_NAME" : "Ablation of malignant prostate tissue, transrectal, with high intensity-focused ultrasound (HIFU), including ultrasound guidance", + "CONCEPT_ID" : 36056040, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by Originalis B.V.", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "55880", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "CPT4", - "CONCEPT_CLASS_ID" : "CPT4" + "CONCEPT_CODE" : "OMOP4981444", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1674,16 +2003,16 @@ }, { "concept" : { - "CONCEPT_ID" : 4073126, - "CONCEPT_NAME" : "Cryotherapy to prostate via perineal probe", + "CONCEPT_ID" : 36065121, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] Box of 1 by Originalis B.V.", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "176319004", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "OMOP4991393", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1691,16 +2020,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2110047, - "CONCEPT_NAME" : "Transperineal placement of needles or catheters into prostate for interstitial radioelement application, with or without cystoscopy", + "CONCEPT_ID" : 36065122, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Originalis B.V.", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "55875", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "CPT4", - "CONCEPT_CLASS_ID" : "CPT4" + "CONCEPT_CODE" : "OMOP4991394", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1708,58 +2037,50 @@ }, { "concept" : { - "CONCEPT_ID" : 37111533, - "CONCEPT_NAME" : "Ultrasonography guided transrectal cryoablation of prostate", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", + "CONCEPT_ID" : 36224401, + "CONCEPT_NAME" : "sipuleucel-T Injectable Product", + "STANDARD_CONCEPT" : "C", + "STANDARD_CONCEPT_CAPTION" : "Classification", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "726544002", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "1159660", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Dose Group" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 12, - "name" : "[PIONEER 2.0] other primaries", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 432851, - "CONCEPT_NAME" : "Secondary malignant neoplastic disease", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", + "CONCEPT_ID" : 36238934, + "CONCEPT_NAME" : "Provenge Injectable Product", + "STANDARD_CONCEPT" : "C", + "STANDARD_CONCEPT_CAPTION" : "Classification", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "128462008", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "1182470", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Dose Group" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 443392, - "CONCEPT_NAME" : "Malignant neoplastic disease", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", + "CONCEPT_ID" : 36247443, + "CONCEPT_NAME" : "pembrolizumab Injectable Product", + "STANDARD_CONCEPT" : "C", + "STANDARD_CONCEPT_CAPTION" : "Classification", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "363346000", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "1547547", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Dose Group" }, "isExcluded" : false, "includeDescendants" : true, @@ -1767,296 +2088,288 @@ }, { "concept" : { - "CONCEPT_ID" : 4112752, - "CONCEPT_NAME" : "Basal cell carcinoma of skin", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", + "CONCEPT_ID" : 36247444, + "CONCEPT_NAME" : "Keytruda Injectable Product", + "STANDARD_CONCEPT" : "C", + "STANDARD_CONCEPT_CAPTION" : "Classification", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "254701007", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "1547553", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Dose Group" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4111921, - "CONCEPT_NAME" : "Squamous cell carcinoma of skin", + "CONCEPT_ID" : 36271591, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] by MSD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "254651007", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP3122466", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 764971, - "CONCEPT_NAME" : "Prostate cancer metastatic to eye", + "CONCEPT_ID" : 36278763, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda] by MSD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "96901000119105", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP3129638", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36716186, - "CONCEPT_NAME" : "Hormone sensitive prostate cancer", + "CONCEPT_ID" : 36404396, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "722103009", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP3096438", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 200962, - "CONCEPT_NAME" : "Primary malignant neoplasm of prostate", + "CONCEPT_ID" : 36405170, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "93974005", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP3097212", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36712762, - "CONCEPT_NAME" : "Recurrent malignant neoplasm of prostate", + "CONCEPT_ID" : 36780945, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution [Keytruda] Box of 1 by MSD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1098981000119101", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4769239", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 37395835, - "CONCEPT_NAME" : "Familial prostate cancer", + "CONCEPT_ID" : 36780946, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "715412008", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4769240", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Branded Box" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4164017, - "CONCEPT_NAME" : "Squamous cell carcinoma of prostate", + "CONCEPT_ID" : 36780947, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "399590005", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4769241", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Branded Drug" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4141960, - "CONCEPT_NAME" : "Hormone refractory prostate cancer", + "CONCEPT_ID" : 36780948, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "427492003", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4769242", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Clinical Box" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4163261, - "CONCEPT_NAME" : "Malignant tumor of prostate", + "CONCEPT_ID" : 36780949, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "399068003", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4769243", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Clinical Drug" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4183913, - "CONCEPT_NAME" : "Malignant tumor involving an organ by direct extension from prostate", + "CONCEPT_ID" : 36787995, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "369598006", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776257", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4283614, - "CONCEPT_NAME" : "Malignant tumor involving bladder by direct extension from prostate", + "CONCEPT_ID" : 36787996, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "369472002", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776258", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4289246, - "CONCEPT_NAME" : "Malignant tumor involving rectum by direct extension from prostate", + "CONCEPT_ID" : 36787997, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "369451000", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776259", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4283740, - "CONCEPT_NAME" : "Malignant tumor involving seminal vesicle by direct extension from prostate", + "CONCEPT_ID" : 36787998, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "369490001", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776260", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4280897, - "CONCEPT_NAME" : "Malignant tumor involving urethra by direct extension from prostate", + "CONCEPT_ID" : 36787999, + "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution [Keytruda] Box of 1 by MSD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "369466002", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776261", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4289379, - "CONCEPT_NAME" : "Malignant tumor involving vasa deferentia by direct extension from prostate", + "CONCEPT_ID" : 36788000, + "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "369483006", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776262", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 13, - "name" : "[PIONEER V2.0] ADT (LHRH & anti-androgen)", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 19058410, - "CONCEPT_NAME" : "degarelix", + "CONCEPT_ID" : 36788001, + "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "475230", + "CONCEPT_CODE" : "OMOP4776263", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2064,16 +2377,16 @@ }, { "concept" : { - "CONCEPT_ID" : 739471, - "CONCEPT_NAME" : "relugolix", + "CONCEPT_ID" : 36788002, + "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "2472778", + "CONCEPT_CODE" : "OMOP4776264", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2081,16 +2394,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35834903, - "CONCEPT_NAME" : "relugolix", + "CONCEPT_ID" : 36788003, + "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP5040508", + "CONCEPT_CODE" : "OMOP4776265", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2098,16 +2411,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1343039, - "CONCEPT_NAME" : "triptorelin", + "CONCEPT_ID" : 36788004, + "CONCEPT_NAME" : "pembrolizumab Intravenous Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "38782", + "CONCEPT_CODE" : "OMOP4776266", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2115,16 +2428,16 @@ }, { "concept" : { - "CONCEPT_ID" : 19089810, - "CONCEPT_NAME" : "gonadorelin", + "CONCEPT_ID" : 36788005, + "CONCEPT_NAME" : "pembrolizumab Intravenous Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "6384", + "CONCEPT_CODE" : "OMOP4776267", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2132,16 +2445,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1366310, - "CONCEPT_NAME" : "goserelin", + "CONCEPT_ID" : 36879366, + "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "50610", + "CONCEPT_CODE" : "OMOP995343", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2149,16 +2462,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1351541, - "CONCEPT_NAME" : "leuprolide", + "CONCEPT_ID" : 36880201, + "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "42375", + "CONCEPT_CODE" : "OMOP1005850", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2166,16 +2479,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1344381, - "CONCEPT_NAME" : "bicalutamide", + "CONCEPT_ID" : 36885115, + "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "83008", + "CONCEPT_CODE" : "OMOP989456", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2183,16 +2496,16 @@ }, { "concept" : { - "CONCEPT_ID" : 19010792, - "CONCEPT_NAME" : "cyproterone", + "CONCEPT_ID" : 36889553, + "CONCEPT_NAME" : "pembrolizumab Prefilled Syringe", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "3014", + "CONCEPT_CODE" : "OMOP998887", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2200,16 +2513,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1356461, - "CONCEPT_NAME" : "flutamide", + "CONCEPT_ID" : 36889599, + "CONCEPT_NAME" : "pembrolizumab Prefilled Syringe [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "4508", + "CONCEPT_CODE" : "OMOP1005312", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2217,16 +2530,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1500211, - "CONCEPT_NAME" : "medroxyprogesterone", + "CONCEPT_ID" : 36892847, + "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "6691", + "CONCEPT_CODE" : "OMOP991291", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2234,16 +2547,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1300978, - "CONCEPT_NAME" : "megestrol", + "CONCEPT_ID" : 37592548, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] by HVD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "6703", + "CONCEPT_CODE" : "OMOP4781994", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -2251,16 +2564,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1315286, - "CONCEPT_NAME" : "nilutamide", + "CONCEPT_ID" : 40224085, + "CONCEPT_NAME" : "250 ML sipuleucel-T 200000 CELLS/ML Injection [Provenge]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "31805", + "CONCEPT_CODE" : "997267", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CLASS_ID" : "Quant Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2268,16 +2581,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35807385, - "CONCEPT_NAME" : "GnRH agonist", - "STANDARD_CONCEPT" : "C", - "STANDARD_CONCEPT_CAPTION" : "Classification", + "CONCEPT_ID" : 40224086, + "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML [Provenge]", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "45768", + "CONCEPT_CODE" : "997265", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "HemOnc", - "CONCEPT_CLASS_ID" : "Component Class" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Drug Comp" }, "isExcluded" : false, "includeDescendants" : true, @@ -2285,41 +2598,33 @@ }, { "concept" : { - "CONCEPT_ID" : 35807349, - "CONCEPT_NAME" : "GnRH antagonist", - "STANDARD_CONCEPT" : "C", - "STANDARD_CONCEPT_CAPTION" : "Classification", + "CONCEPT_ID" : 40224095, + "CONCEPT_NAME" : "sipuleucel-T", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "45632", + "CONCEPT_CODE" : "997261", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "HemOnc", - "CONCEPT_CLASS_ID" : "Component Class" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 14, - "name" : "[PIONEER V2.0] ARTA", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 40239056, - "CONCEPT_NAME" : "abiraterone", + "CONCEPT_ID" : 40224096, + "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1100072", + "CONCEPT_CODE" : "997262", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CLASS_ID" : "Clinical Drug Comp" }, "isExcluded" : false, "includeDescendants" : true, @@ -2327,16 +2632,16 @@ }, { "concept" : { - "CONCEPT_ID" : 963987, - "CONCEPT_NAME" : "apalutamide", + "CONCEPT_ID" : 40224097, + "CONCEPT_NAME" : "250 ML sipuleucel-T 200000 CELLS/ML Injection", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1999574", + "CONCEPT_CODE" : "997264", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CLASS_ID" : "Quant Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2344,16 +2649,16 @@ }, { "concept" : { - "CONCEPT_ID" : 42900250, - "CONCEPT_NAME" : "enzalutamide", + "CONCEPT_ID" : 40716385, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1307298", + "CONCEPT_CODE" : "OMOP4740730", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -2361,41 +2666,33 @@ }, { "concept" : { - "CONCEPT_ID" : 1361291, - "CONCEPT_NAME" : "darolutamide", + "CONCEPT_ID" : 40745552, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] Box of 1 by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "2180325", + "CONCEPT_CODE" : "OMOP4711640", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 15, - "name" : "[PIONEER V2.0] Chemotherapy (docetaxel & cabazitaxe & paclitaxel)", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 1315942, - "CONCEPT_NAME" : "docetaxel", + "CONCEPT_ID" : 40745553, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "72962", + "CONCEPT_CODE" : "OMOP4711639", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2403,16 +2700,16 @@ }, { "concept" : { - "CONCEPT_ID" : 40222431, - "CONCEPT_NAME" : "cabazitaxel", + "CONCEPT_ID" : 40745554, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "996051", + "CONCEPT_CODE" : "OMOP4711638", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -2420,66 +2717,50 @@ }, { "concept" : { - "CONCEPT_ID" : 1378382, - "CONCEPT_NAME" : "paclitaxel", + "CONCEPT_ID" : 40745555, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "56946", + "CONCEPT_CODE" : "OMOP4711637", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 16, - "name" : "[PIONEER V2.0] Lutetium", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 44816340, - "CONCEPT_NAME" : "lutetium", + "CONCEPT_ID" : 41079944, + "CONCEPT_NAME" : "sipuleucel-T Injectable Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1534772", + "CONCEPT_CODE" : "OMOP2277906", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 17, - "name" : "[PIONEER V2.0] PARP inhibitor", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 45892579, - "CONCEPT_NAME" : "olaparib", + "CONCEPT_ID" : 41122672, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1597582", + "CONCEPT_CODE" : "OMOP2320634", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2487,38 +2768,30 @@ }, { "concept" : { - "CONCEPT_ID" : 1718850, - "CONCEPT_NAME" : "rucaparib", + "CONCEPT_ID" : 41133743, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] Box of 1 by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1862579", + "CONCEPT_CODE" : "OMOP2331705", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 18, - "name" : "[PIONEER V2.0] Immunotherapy (sipuleucel-T & pembrolizumab)", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 586622, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection Box of 1", + "CONCEPT_ID" : 41271431, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3138293", + "CONCEPT_CODE" : "OMOP2469393", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", "CONCEPT_CLASS_ID" : "Clinical Drug Box" @@ -2529,16 +2802,16 @@ }, { "concept" : { - "CONCEPT_ID" : 587503, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection Box of 1", + "CONCEPT_ID" : 42658251, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by MSD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3136350", + "CONCEPT_CODE" : "OMOP4869815", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Clinical Box" + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -2546,16 +2819,16 @@ }, { "concept" : { - "CONCEPT_ID" : 784328, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] Box of 1 by MSD", + "CONCEPT_ID" : 42921578, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4832151", + "CONCEPT_CODE" : "OMOP4648403", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CLASS_ID" : "Quant Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2563,16 +2836,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1830614, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Abacus Medicine", + "CONCEPT_ID" : 42963145, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injectable Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP5155867", + "CONCEPT_CODE" : "OMOP4689628", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2580,16 +2853,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1832328, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by Abacus Medicine", + "CONCEPT_ID" : 42963146, + "CONCEPT_NAME" : "pembrolizumab Injectable Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP5157569", + "CONCEPT_CODE" : "OMOP4689629", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CLASS_ID" : "Branded Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2597,13 +2870,13 @@ }, { "concept" : { - "CONCEPT_ID" : 21021970, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] Box of 1 by Merck", + "CONCEPT_ID" : 43173544, + "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe [Keytruda] Box of 1 by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP344279", + "CONCEPT_CODE" : "OMOP496837", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", "CONCEPT_CLASS_ID" : "Marketed Product" @@ -2614,16 +2887,16 @@ }, { "concept" : { - "CONCEPT_ID" : 21090575, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] Box of 1", + "CONCEPT_ID" : 44075484, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP344278", + "CONCEPT_CODE" : "OMOP1070115", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -2631,16 +2904,16 @@ }, { "concept" : { - "CONCEPT_ID" : 21120047, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection Box of 1", + "CONCEPT_ID" : 44081458, + "CONCEPT_NAME" : "pembrolizumab Injectable Suspension", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP344275", + "CONCEPT_CODE" : "OMOP1076089", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2648,16 +2921,16 @@ }, { "concept" : { - "CONCEPT_ID" : 21159533, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] by Merck", + "CONCEPT_ID" : 44082527, + "CONCEPT_NAME" : "pembrolizumab Injectable Suspension [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP344277", + "CONCEPT_CODE" : "OMOP1077158", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CLASS_ID" : "Branded Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2665,16 +2938,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35129163, - "CONCEPT_NAME" : "0.8 ML pembrolizumab 25 MG/ML Injectable Solution", + "CONCEPT_ID" : 44084103, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4786432", + "CONCEPT_CODE" : "OMOP1078734", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Clinical Drug" + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2682,16 +2955,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35139888, - "CONCEPT_NAME" : "0.8 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda]", + "CONCEPT_ID" : 44124784, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4797037", + "CONCEPT_CODE" : "OMOP1119415", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Branded Drug" + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2699,16 +2972,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35604048, - "CONCEPT_NAME" : "sipuleucel-T Injection", + "CONCEPT_ID" : 44164861, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injectable Solution Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1726181", + "CONCEPT_CODE" : "OMOP3041584", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2716,16 +2989,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35604049, - "CONCEPT_NAME" : "sipuleucel-T Injection [Provenge]", + "CONCEPT_ID" : 44164862, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injectable Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1726183", + "CONCEPT_CODE" : "OMOP3041585", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug Form" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2733,16 +3006,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35604050, - "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML Injection", + "CONCEPT_ID" : 44175744, + "CONCEPT_NAME" : "pembrolizumab Injectable Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1726185", + "CONCEPT_CODE" : "OMOP3052467", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2750,16 +3023,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35604051, - "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML Injection [Provenge]", + "CONCEPT_ID" : 44184353, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1726186", + "CONCEPT_CODE" : "OMOP3061076", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2767,16 +3040,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35803678, - "CONCEPT_NAME" : "Pembrolizumab monotherapy", + "CONCEPT_ID" : 44191541, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "3199", - "DOMAIN_ID" : "Regimen", - "VOCABULARY_ID" : "HemOnc", - "CONCEPT_CLASS_ID" : "Regimen" + "CONCEPT_CODE" : "OMOP3068264", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Branded Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2784,16 +3057,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36056039, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] Box of 1 by Originalis B.V.", + "CONCEPT_ID" : 44191562, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4981443", + "CONCEPT_CODE" : "OMOP3068285", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CLASS_ID" : "Quant Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2801,16 +3074,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36056040, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by Originalis B.V.", + "CONCEPT_ID" : 44191588, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4981444", + "CONCEPT_CODE" : "OMOP3068311", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CLASS_ID" : "Quant Clinical Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2818,13 +3091,13 @@ }, { "concept" : { - "CONCEPT_ID" : 36065121, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] Box of 1 by Originalis B.V.", + "CONCEPT_ID" : 44191599, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda] Box of 1 by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4991393", + "CONCEPT_CODE" : "OMOP3068322", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", "CONCEPT_CLASS_ID" : "Marketed Product" @@ -2835,16 +3108,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36065122, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Originalis B.V.", + "CONCEPT_ID" : 45775965, + "CONCEPT_NAME" : "pembrolizumab", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4991394", + "CONCEPT_CODE" : "1547545", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -2852,16 +3125,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36224401, - "CONCEPT_NAME" : "sipuleucel-T Injectable Product", - "STANDARD_CONCEPT" : "C", - "STANDARD_CONCEPT_CAPTION" : "Classification", + "CONCEPT_ID" : 45775966, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1159660", + "CONCEPT_CODE" : "1547546", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Dose Group" + "CONCEPT_CLASS_ID" : "Clinical Drug Comp" }, "isExcluded" : false, "includeDescendants" : true, @@ -2869,16 +3142,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36238934, - "CONCEPT_NAME" : "Provenge Injectable Product", - "STANDARD_CONCEPT" : "C", - "STANDARD_CONCEPT_CAPTION" : "Classification", + "CONCEPT_ID" : 45775970, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML [Keytruda]", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1182470", + "CONCEPT_CODE" : "1547551", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Dose Group" + "CONCEPT_CLASS_ID" : "Branded Drug Comp" }, "isExcluded" : false, "includeDescendants" : true, @@ -2886,16 +3159,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36247443, - "CONCEPT_NAME" : "pembrolizumab Injectable Product", - "STANDARD_CONCEPT" : "C", - "STANDARD_CONCEPT_CAPTION" : "Classification", + "CONCEPT_ID" : 46276407, + "CONCEPT_NAME" : "pembrolizumab 50 MG", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1547547", + "CONCEPT_CODE" : "1657744", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Dose Group" + "CONCEPT_CLASS_ID" : "Clinical Drug Comp" }, "isExcluded" : false, "includeDescendants" : true, @@ -2903,16 +3176,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36247444, - "CONCEPT_NAME" : "Keytruda Injectable Product", - "STANDARD_CONCEPT" : "C", - "STANDARD_CONCEPT_CAPTION" : "Classification", + "CONCEPT_ID" : 46276408, + "CONCEPT_NAME" : "pembrolizumab Injection", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1547553", + "CONCEPT_CODE" : "1657745", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Dose Group" + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2920,16 +3193,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36271591, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] by MSD", + "CONCEPT_ID" : 46276409, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3122466", + "CONCEPT_CODE" : "1657746", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2937,16 +3210,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36278763, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda] by MSD", + "CONCEPT_ID" : 46276410, + "CONCEPT_NAME" : "pembrolizumab 50 MG [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3129638", + "CONCEPT_CODE" : "1657747", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Drug Comp" }, "isExcluded" : false, "includeDescendants" : true, @@ -2954,16 +3227,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36404396, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution Box of 1", + "CONCEPT_ID" : 46276411, + "CONCEPT_NAME" : "pembrolizumab Injection [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3096438", + "CONCEPT_CODE" : "1657748", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2971,16 +3244,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36405170, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution", + "CONCEPT_ID" : 46276412, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3097212", + "CONCEPT_CODE" : "1657749", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2988,16 +3261,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36780945, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution [Keytruda] Box of 1 by MSD", + "CONCEPT_ID" : 46276413, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4769239", + "CONCEPT_CODE" : "1657750", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Quant Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -3005,16 +3278,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36780946, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution [Keytruda] Box of 1", + "CONCEPT_ID" : 46276414, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4769240", + "CONCEPT_CODE" : "1657751", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Branded Box" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Quant Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -3022,16 +3295,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36780947, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution [Keytruda]", + "CONCEPT_ID" : 46276415, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4769241", + "CONCEPT_CODE" : "1657752", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Branded Drug" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -3039,33 +3312,41 @@ }, { "concept" : { - "CONCEPT_ID" : 36780948, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution Box of 1", + "CONCEPT_ID" : 46276416, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4769242", + "CONCEPT_CODE" : "1657753", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Clinical Box" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 17, + "name" : "[PIONEER V2.0] Radium-223", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 36780949, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution", + "CONCEPT_ID" : 45775578, + "CONCEPT_NAME" : "radium", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4769243", + "CONCEPT_CODE" : "1546450", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Clinical Drug" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -3073,16 +3354,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36787995, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution [Keytruda] Box of 1", + "CONCEPT_ID" : 902727, + "CONCEPT_NAME" : "Radium-223", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776257", + "CONCEPT_CODE" : "OMOP5042947", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -3090,50 +3371,58 @@ }, { "concept" : { - "CONCEPT_ID" : 36787996, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution [Keytruda]", + "CONCEPT_ID" : 41267222, + "CONCEPT_NAME" : "Radium Oral Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776258", + "CONCEPT_CODE" : "OMOP2465184", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, - "isExcluded" : false, - "includeDescendants" : true, + "isExcluded" : true, + "includeDescendants" : false, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36787997, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution Box of 1", + "CONCEPT_ID" : 43526934, + "CONCEPT_NAME" : "radium chloride Ra-223", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776259", + "CONCEPT_CODE" : "1424174", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 18, + "name" : "[PIONEER 2.0] Hx of prostate cancer", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 36787998, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution", + "CONCEPT_ID" : 3169330, + "CONCEPT_NAME" : "Personal history of prostate cancer", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776260", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "4220001000004104", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "Nebraska Lexicon", + "CONCEPT_CLASS_ID" : "Context-dependent" }, "isExcluded" : false, "includeDescendants" : true, @@ -3141,33 +3430,41 @@ }, { "concept" : { - "CONCEPT_ID" : 36787999, - "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution [Keytruda] Box of 1 by MSD", + "CONCEPT_ID" : 4180749, + "CONCEPT_NAME" : "History of malignant neoplasm of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776261", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "428262008", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Context-dependent" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 19, + "name" : "[Pioneer 2.0] Local trt", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 36788000, - "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution [Keytruda] Box of 1", + "CONCEPT_ID" : 4235738, + "CONCEPT_NAME" : "Prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776262", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CODE" : "90470006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -3175,645 +3472,645 @@ }, { "concept" : { - "CONCEPT_ID" : 36788001, - "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution [Keytruda]", + "CONCEPT_ID" : 2108677, + "CONCEPT_NAME" : "Patient counseling at a minimum on all of the following treatment options for clinically localized prostate cancer: active surveillance, and interstitial prostate brachytherapy, and external beam radiotherapy, and radical prostatectomy, provided prior to ", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776263", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "4163F", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36788002, - "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution Box of 1", + "CONCEPT_ID" : 4216658, + "CONCEPT_NAME" : "Radical cystoprostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776264", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "CONCEPT_CODE" : "81232004", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, - "includeDescendants" : true, + "isExcluded" : true, + "includeDescendants" : false, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36788003, - "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution", + "CONCEPT_ID" : 4306299, + "CONCEPT_NAME" : "Excision of lesion of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776265", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "83154001", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36788004, - "CONCEPT_NAME" : "pembrolizumab Intravenous Solution [Keytruda]", + "CONCEPT_ID" : 4338661, + "CONCEPT_NAME" : "Complete transurethral resection of prostate, including control of postoperative bleeding", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776266", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Form" + "CONCEPT_CODE" : "87795007", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36788005, - "CONCEPT_NAME" : "pembrolizumab Intravenous Solution", + "CONCEPT_ID" : 3187777, + "CONCEPT_NAME" : "Cystoscopy with transurethral prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776267", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "21360001000004106", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "Nebraska Lexicon", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36879366, - "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe [Keytruda]", + "CONCEPT_ID" : 40487861, + "CONCEPT_NAME" : "Endoscopic excision of prostate using holmium laser", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP995343", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "446445003", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36880201, - "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe Box of 1", + "CONCEPT_ID" : 4176312, + "CONCEPT_NAME" : "Endoscopic laser prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1005850", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "CONCEPT_CODE" : "427985002", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36885115, - "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe [Keytruda] Box of 1", + "CONCEPT_ID" : 4193061, + "CONCEPT_NAME" : "Endoscopic resection of prostate using an electrotome", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP989456", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CODE" : "314202001", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36889553, - "CONCEPT_NAME" : "pembrolizumab Prefilled Syringe", + "CONCEPT_ID" : 2777698, + "CONCEPT_NAME" : "Excision of Prostate, Open Approach", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP998887", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "0VB00ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36889599, - "CONCEPT_NAME" : "pembrolizumab Prefilled Syringe [Keytruda]", + "CONCEPT_ID" : 2777697, + "CONCEPT_NAME" : "Excision of Prostate, Open Approach, Diagnostic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1005312", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Form" + "CONCEPT_CODE" : "0VB00ZX", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36892847, - "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe", + "CONCEPT_ID" : 2777700, + "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Approach", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP991291", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "0VB03ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 37592548, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] by HVD", + "CONCEPT_ID" : 2777699, + "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Approach, Diagnostic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4781994", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "0VB03ZX", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40224085, - "CONCEPT_NAME" : "250 ML sipuleucel-T 200000 CELLS/ML Injection [Provenge]", + "CONCEPT_ID" : 2777702, + "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Endoscopic Approach", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "997267", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Quant Branded Drug" + "CONCEPT_CODE" : "0VB04ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40224086, - "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML [Provenge]", + "CONCEPT_ID" : 2777701, + "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Endoscopic Approach, Diagnostic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "997265", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug Comp" + "CONCEPT_CODE" : "0VB04ZX", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40224095, - "CONCEPT_NAME" : "sipuleucel-T", + "CONCEPT_ID" : 2777704, + "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "997261", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CODE" : "0VB07ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40224096, - "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML", + "CONCEPT_ID" : 2777703, + "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening, Diagnostic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "997262", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug Comp" + "CONCEPT_CODE" : "0VB07ZX", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40224097, - "CONCEPT_NAME" : "250 ML sipuleucel-T 200000 CELLS/ML Injection", + "CONCEPT_ID" : 2777706, + "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening Endoscopic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "997264", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Quant Clinical Drug" + "CONCEPT_CODE" : "0VB08ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40716385, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by Merck", + "CONCEPT_ID" : 2777705, + "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening Endoscopic, Diagnostic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4740730", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "0VB08ZX", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40745552, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] Box of 1 by Merck", + "CONCEPT_ID" : 44783041, + "CONCEPT_NAME" : "Holmium laser enucleation of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4711640", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "699075006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40745553, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] Box of 1", + "CONCEPT_ID" : 4239543, + "CONCEPT_NAME" : "One stage subtotal suprapubic prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4711639", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CODE" : "91531008", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40745554, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Merck", + "CONCEPT_ID" : 2003966, + "CONCEPT_NAME" : "Other transurethral prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4711638", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "60.29", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD9Proc", + "CONCEPT_CLASS_ID" : "4-dig billing code" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40745555, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda]", + "CONCEPT_ID" : 4021570, + "CONCEPT_NAME" : "Radical cystoprostatourethrectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4711637", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "176106009", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 41079944, - "CONCEPT_NAME" : "sipuleucel-T Injectable Solution", + "CONCEPT_ID" : 2780477, + "CONCEPT_NAME" : "Resection of Prostate, Open Approach", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP2277906", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "0VT00ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 41122672, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] Box of 1", + "CONCEPT_ID" : 2780478, + "CONCEPT_NAME" : "Resection of Prostate, Percutaneous Endoscopic Approach", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP2320634", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CODE" : "0VT04ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 41133743, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] Box of 1 by Merck", + "CONCEPT_ID" : 2780479, + "CONCEPT_NAME" : "Resection of Prostate, Via Natural or Artificial Opening", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP2331705", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "0VT07ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 41271431, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension Box of 1", + "CONCEPT_ID" : 2780480, + "CONCEPT_NAME" : "Resection of Prostate, Via Natural or Artificial Opening Endoscopic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP2469393", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "CONCEPT_CODE" : "0VT08ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 42658251, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by MSD", + "CONCEPT_ID" : 4341384, + "CONCEPT_NAME" : "Salvage cystoprostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4869815", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "236211007", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 42921578, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda]", + "CONCEPT_ID" : 4341893, + "CONCEPT_NAME" : "Salvage cystoprostatourethrectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4648403", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Branded Drug" + "CONCEPT_CODE" : "236209003", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 42963145, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injectable Solution [Keytruda]", + "CONCEPT_ID" : 4212360, + "CONCEPT_NAME" : "Subtotal perineal prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4689628", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "57525009", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 42963146, - "CONCEPT_NAME" : "pembrolizumab Injectable Solution [Keytruda]", + "CONCEPT_ID" : 4147673, + "CONCEPT_NAME" : "Subtotal prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4689629", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Form" + "CONCEPT_CODE" : "30426000", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 43173544, - "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe [Keytruda] Box of 1 by Merck", + "CONCEPT_ID" : 4078386, + "CONCEPT_NAME" : "Subtotal retropubic prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP496837", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "19149007", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44075484, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] by Merck", + "CONCEPT_ID" : 4073700, + "CONCEPT_NAME" : "Transurethral laser prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1070115", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "176288003", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44081458, - "CONCEPT_NAME" : "pembrolizumab Injectable Suspension", + "CONCEPT_ID" : 4234536, + "CONCEPT_NAME" : "Transurethral prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1076089", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "90199006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44082527, - "CONCEPT_NAME" : "pembrolizumab Injectable Suspension [Keytruda]", + "CONCEPT_ID" : 4287859, + "CONCEPT_NAME" : "Transurethral resection of prostate, first stage of two stages", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1077158", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Form" + "CONCEPT_CODE" : "68986004", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44084103, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension", + "CONCEPT_ID" : 44783043, + "CONCEPT_NAME" : "Transurethral thulium laser enucleation of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1078734", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "699077003", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44124784, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda]", + "CONCEPT_ID" : 4071791, + "CONCEPT_NAME" : "Transvesical two stage prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1119415", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "176260009", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44164861, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injectable Solution Box of 1", + "CONCEPT_ID" : 4054558, + "CONCEPT_NAME" : "Two stage subtotal suprapubic prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3041584", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "CONCEPT_CODE" : "21190008", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44164862, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injectable Solution", + "CONCEPT_ID" : 4330932, + "CONCEPT_NAME" : "CT of prostate for radiotherapy planning", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3041585", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "429856001", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -3821,16 +4118,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44175744, - "CONCEPT_NAME" : "pembrolizumab Injectable Solution", + "CONCEPT_ID" : 37396025, + "CONCEPT_NAME" : "CT of prostate with contrast for radiotherapy planning", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3052467", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "715687002", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -3838,16 +4135,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44184353, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection [Keytruda] Box of 1", + "CONCEPT_ID" : 2108724, + "CONCEPT_NAME" : "External beam radiotherapy as primary therapy to prostate with or without nodal irradiation (PRCA)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3061076", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CODE" : "4200F", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" }, "isExcluded" : false, "includeDescendants" : true, @@ -3855,16 +4152,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44191541, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda] Box of 1", + "CONCEPT_ID" : 2108725, + "CONCEPT_NAME" : "External beam radiotherapy with or without nodal irradiation as adjuvant or salvage therapy for prostate cancer patient (PRCA)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3068264", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Branded Box" + "CONCEPT_CODE" : "4201F", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" }, "isExcluded" : false, "includeDescendants" : true, @@ -3872,16 +4169,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44191562, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution", + "CONCEPT_ID" : 4198015, + "CONCEPT_NAME" : "MRI of prostate for radiotherapy planning", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3068285", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Clinical Drug" + "CONCEPT_CODE" : "431850000", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -3889,16 +4186,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44191588, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution Box of 1", + "CONCEPT_ID" : 43533205, + "CONCEPT_NAME" : "Low dose rate (ldr) prostate brachytherapy services, composite rate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3068311", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Clinical Box" + "CONCEPT_CODE" : "G0458", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "HCPCS", + "CONCEPT_CLASS_ID" : "HCPCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -3906,16 +4203,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44191599, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda] Box of 1 by Merck", + "CONCEPT_ID" : 2790073, + "CONCEPT_NAME" : "Contact Radiation of Prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3068322", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "DVY07ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -3923,16 +4220,16 @@ }, { "concept" : { - "CONCEPT_ID" : 45775965, - "CONCEPT_NAME" : "pembrolizumab", + "CONCEPT_ID" : 1781260, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Cesium 131 (Cs-131)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1547545", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CODE" : "DV10B6Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -3940,16 +4237,16 @@ }, { "concept" : { - "CONCEPT_ID" : 45775966, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML", + "CONCEPT_ID" : 4041984, + "CONCEPT_NAME" : "Laser ablation of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1547546", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug Comp" + "CONCEPT_CODE" : "118164001", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -3957,16 +4254,16 @@ }, { "concept" : { - "CONCEPT_ID" : 45775970, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML [Keytruda]", + "CONCEPT_ID" : 2789856, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Other Isotope", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1547551", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug Comp" + "CONCEPT_CODE" : "DV10BYZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -3974,16 +4271,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276407, - "CONCEPT_NAME" : "pembrolizumab 50 MG", + "CONCEPT_ID" : 1524039, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Palladium 103 (Pd-103), Unidirectional Source", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657744", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug Comp" + "CONCEPT_CODE" : "DV10BB1", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -3991,16 +4288,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276408, - "CONCEPT_NAME" : "pembrolizumab Injection", + "CONCEPT_ID" : 37111533, + "CONCEPT_NAME" : "Ultrasonography guided transrectal cryoablation of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657745", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "726544002", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -4008,16 +4305,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276409, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection", + "CONCEPT_ID" : 4061656, + "CONCEPT_NAME" : "Microwave therapy to prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657746", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "169429005", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -4025,16 +4322,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276410, - "CONCEPT_NAME" : "pembrolizumab 50 MG [Keytruda]", + "CONCEPT_ID" : 2789850, + "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Other Isotope", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657747", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug Comp" + "CONCEPT_CODE" : "DV109YZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4042,16 +4339,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276411, - "CONCEPT_NAME" : "pembrolizumab Injection [Keytruda]", + "CONCEPT_ID" : 2789851, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Cesium 137 (Cs-137)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657748", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug Form" + "CONCEPT_CODE" : "DV10B7Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4059,16 +4356,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276412, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda]", + "CONCEPT_ID" : 2789848, + "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Palladium 103 (Pd-103)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657749", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "DV109BZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4076,16 +4373,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276413, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection", + "CONCEPT_ID" : 2789849, + "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Californium 252 (Cf-252)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657750", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Quant Clinical Drug" + "CONCEPT_CODE" : "DV109CZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4093,16 +4390,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276414, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda]", + "CONCEPT_ID" : 2789854, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Palladium 103 (Pd-103)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657751", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Quant Branded Drug" + "CONCEPT_CODE" : "DV10BBZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4110,16 +4407,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276415, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection", + "CONCEPT_ID" : 2789855, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Californium 252 (Cf-252)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657752", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "DV10BCZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4127,41 +4424,33 @@ }, { "concept" : { - "CONCEPT_ID" : 46276416, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection [Keytruda]", + "CONCEPT_ID" : 2789852, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Iridium 192 (Ir-192)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657753", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "DV10B8Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 19, - "name" : "[PIONEER V2.0] Radium-223", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 45775578, - "CONCEPT_NAME" : "radium", + "CONCEPT_ID" : 2789853, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Iodine 125 (I-125)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1546450", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CODE" : "DV10B9Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4169,16 +4458,16 @@ }, { "concept" : { - "CONCEPT_ID" : 902727, - "CONCEPT_NAME" : "Radium-223", + "CONCEPT_ID" : 2789846, + "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Iridium 192 (Ir-192)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP5042947", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CODE" : "DV1098Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4186,406 +4475,668 @@ }, { "concept" : { - "CONCEPT_ID" : 41267222, - "CONCEPT_NAME" : "Radium Oral Solution", + "CONCEPT_ID" : 2789847, + "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Iodine 125 (I-125)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP2465184", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "DV1099Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : true, - "includeDescendants" : false, + "isExcluded" : false, + "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 43526934, - "CONCEPT_NAME" : "radium chloride Ra-223", + "CONCEPT_ID" : 2789845, + "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Cesium 137 (Cs-137)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1424174", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CODE" : "DV1097Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - } - ], - "QualifiedLimit" : { - "Type" : "First" - }, - "ExpressionLimit" : { - "Type" : "First" - }, - "InclusionRules" : [ - { - "name" : "Male", - "expression" : { - "Type" : "ALL", - "CriteriaList" : [], - "DemographicCriteriaList" : [ + }, { - "Gender" : [ - { - "CONCEPT_ID" : 8507, - "CONCEPT_NAME" : "MALE", - "STANDARD_CONCEPT" : null, - "STANDARD_CONCEPT_CAPTION" : "Unknown", - "INVALID_REASON" : null, - "INVALID_REASON_CAPTION" : "Unknown", - "CONCEPT_CODE" : "M", - "DOMAIN_ID" : "Gender", - "VOCABULARY_ID" : "Gender", - "CONCEPT_CLASS_ID" : null - } - ] - } - ], - "Groups" : [] - } - }, - { - "name" : "age 18+", - "expression" : { - "Type" : "ALL", - "CriteriaList" : [], - "DemographicCriteriaList" : [ + "concept" : { + "CONCEPT_ID" : 759648, + "CONCEPT_NAME" : "Ablation of malignant prostate tissue, transrectal, with high intensity-focused ultrasound (HIFU), including ultrasound guidance", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "55880", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, { - "Age" : { - "Value" : 18, - "Op" : "gte" - } - } - ], - "Groups" : [] - } - }, - { - "name" : "metastasis", - "expression" : { - "Type" : "ALL", - "CriteriaList" : [], - "DemographicCriteriaList" : [], - "Groups" : [ + "concept" : { + "CONCEPT_ID" : 4073126, + "CONCEPT_NAME" : "Cryotherapy to prostate via perineal probe", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176319004", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, { - "Type" : "ANY", - "CriteriaList" : [ - { - "Criteria" : { - "ConditionOccurrence" : { - "CorrelatedCriteria" : { - "Type" : "ALL", - "CriteriaList" : [], - "DemographicCriteriaList" : [], - "Groups" : [ - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "ConditionOccurrence" : { - "CodesetId" : 2, - "ConditionTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 30, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } + "concept" : { + "CONCEPT_ID" : 2110047, + "CONCEPT_NAME" : "Transperineal placement of needles or catheters into prostate for interstitial radioelement application, with or without cystoscopy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "55875", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 37111533, + "CONCEPT_NAME" : "Ultrasonography guided transrectal cryoablation of prostate", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "726544002", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2110046, + "CONCEPT_NAME" : "Cryosurgical ablation of the prostate (includes ultrasonic guidance and monitoring)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "55873", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2110035, + "CONCEPT_NAME" : "Prostatectomy (including control of postoperative bleeding, vasectomy, meatotomy, urethral calibration and/or dilation, and internal urethrotomy); suprapubic, subtotal, 1 or 2 stages", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "55821", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2108678, + "CONCEPT_NAME" : "Adjuvant (ie, in combination with external beam radiotherapy to the prostate for prostate cancer) hormonal therapy (gonadotropin-releasing hormone [GnRH] agonist or antagonist) prescribed/administered (PRCA)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "4164F", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2101059, + "CONCEPT_NAME" : "Anesthesia for; perineal prostatectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "00908", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2777698, + "CONCEPT_NAME" : "Excision of Prostate, Open Approach", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "0VB00ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 40490346, + "CONCEPT_NAME" : "Transrectal high intensity focused ultrasound ablation of prostate", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "446941000", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2110043, + "CONCEPT_NAME" : "Exposure of prostate, any approach, for insertion of radioactive substance; with bilateral pelvic lymphadenectomy, including external iliac, hypogastric and obturator nodes", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "55865", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2789830, + "CONCEPT_NAME" : "Beam Radiation of Prostate using Photons >10 MeV", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "DV002ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 709928, + "CONCEPT_NAME" : "Transurethral ablation of malignant prostate tissue by high-energy water vapor thermotherapy, including intraoperative imaging and needle guidance", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "0582T", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 42733763, + "CONCEPT_NAME" : "Transurethral resection of prostate; first stage of two-stage resection (partial resection) (Deprecated)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "52612", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 42733764, + "CONCEPT_NAME" : "Transurethral resection of prostate; second stage of two-stage resection (resection completed) (Deprecated)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "52614", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + } + ] + } + } + ], + "QualifiedLimit" : { + "Type" : "First" + }, + "ExpressionLimit" : { + "Type" : "All" + }, + "InclusionRules" : [ + { + "name" : "Male", + "expression" : { + "Type" : "ALL", + "CriteriaList" : [], + "DemographicCriteriaList" : [ + { + "Gender" : [ + { + "CONCEPT_ID" : 8507, + "CONCEPT_NAME" : "MALE", + "STANDARD_CONCEPT" : null, + "STANDARD_CONCEPT_CAPTION" : "Unknown", + "INVALID_REASON" : null, + "INVALID_REASON_CAPTION" : "Unknown", + "CONCEPT_CODE" : "M", + "DOMAIN_ID" : "Gender", + "VOCABULARY_ID" : "Gender", + "CONCEPT_CLASS_ID" : null + } + ] + } + ], + "Groups" : [] + } + }, + { + "name" : "age 18+", + "expression" : { + "Type" : "ALL", + "CriteriaList" : [], + "DemographicCriteriaList" : [ + { + "Age" : { + "Value" : 18, + "Op" : "gte" + } + } + ], + "Groups" : [] + } + }, + { + "name" : "no other drugs", + "expression" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 14, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 15, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 16, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 17, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 13, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + }, + { + "name" : "No other primary", + "expression" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "ConditionOccurrence" : { + "CodesetId" : 10, + "ConditionTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "Observation" : { + "CodesetId" : 10, + "ObservationTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + }, + { + "name" : "metastasis", + "expression" : { + "Type" : "ANY", + "CriteriaList" : [], + "DemographicCriteriaList" : [], + "Groups" : [ + { + "Type" : "AT_LEAST", + "Count" : 1, + "CriteriaList" : [ + { + "Criteria" : { + "ConditionOccurrence" : { + "CorrelatedCriteria" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "ConditionOccurrence" : { + "CodesetId" : 2, + "ConditionTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 }, - { - "Criteria" : { - "ProcedureOccurrence" : { - "CodesetId" : 4, - "ProcedureTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 1, - "Coeff" : -1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } + "End" : { + "Days" : 30, + "Coeff" : 1 }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 183, - "Coeff" : -1 - }, - "End" : { - "Days" : 1, - "Coeff" : -1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } }, { - "Type" : "ANY", - "CriteriaList" : [ - { - "Criteria" : { - "ProcedureOccurrence" : { - "CodesetId" : 11, - "ProcedureTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 184, - "Coeff" : -1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "Observation" : { - "CodesetId" : 11, - "ObservationTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 184, - "Coeff" : -1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 11, + "DrugTypeExclude" : false } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - }, - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } + "End" : { + "Days" : 1, + "Coeff" : -1 }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "ProcedureOccurrence" : { + "CodesetId" : 4, + "ProcedureTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 18, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } + "End" : { + "Days" : 1, + "Coeff" : -1 }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [ + { + "Type" : "ANY", + "CriteriaList" : [ { "Criteria" : { - "DrugExposure" : { + "Observation" : { "CodesetId" : 19, - "DrugTypeExclude" : false + "ObservationTypeExclude" : false } }, "StartWindow" : { "Start" : { - "Days" : 0, "Coeff" : -1 }, "End" : { - "Days" : 183, - "Coeff" : 1 + "Days" : 184, + "Coeff" : -1 }, "UseIndexEnd" : false, "UseEventEnd" : false @@ -4593,26 +5144,25 @@ "RestrictVisit" : false, "IgnoreObservationPeriod" : false, "Occurrence" : { - "Type" : 0, - "Count" : 0, + "Type" : 2, + "Count" : 1, "IsDistinct" : false } }, { "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false + "ProcedureOccurrence" : { + "CodesetId" : 19, + "ProcedureTypeExclude" : false } }, "StartWindow" : { "Start" : { - "Days" : 0, "Coeff" : -1 }, "End" : { - "Days" : 183, - "Coeff" : 1 + "Days" : 184, + "Coeff" : -1 }, "UseIndexEnd" : false, "UseEventEnd" : false @@ -4671,7 +5221,6 @@ }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -4691,9 +5240,9 @@ }, { "Criteria" : { - "ProcedureOccurrence" : { - "CodesetId" : 4, - "ProcedureTypeExclude" : false + "DrugExposure" : { + "CodesetId" : 11, + "DrugTypeExclude" : false } }, "StartWindow" : { @@ -4717,14 +5266,13 @@ }, { "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false + "ProcedureOccurrence" : { + "CodesetId" : 4, + "ProcedureTypeExclude" : false } }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -4751,7 +5299,7 @@ { "Criteria" : { "Observation" : { - "CodesetId" : 11, + "CodesetId" : 19, "ObservationTypeExclude" : false } }, @@ -4777,7 +5325,7 @@ { "Criteria" : { "ProcedureOccurrence" : { - "CodesetId" : 11, + "CodesetId" : 19, "ProcedureTypeExclude" : false } }, @@ -4803,208 +5351,62 @@ ], "DemographicCriteriaList" : [], "Groups" : [] - }, - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 18, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 19, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] } ] }, - "CodesetId" : 6, + "CodesetId" : 7, "First" : true, - "MeasurementTypeExclude" : false + "MeasurementTypeExclude" : false, + "ValueAsConcept" : [ + { + "CONCEPT_ID" : 45878386, + "CONCEPT_NAME" : "M1C", + "STANDARD_CONCEPT" : null, + "STANDARD_CONCEPT_CAPTION" : "Unknown", + "INVALID_REASON" : null, + "INVALID_REASON_CAPTION" : "Unknown", + "CONCEPT_CODE" : "LA4625-5", + "DOMAIN_ID" : "Meas Value", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : null + }, + { + "CONCEPT_ID" : 45881618, + "CONCEPT_NAME" : "M1B", + "STANDARD_CONCEPT" : null, + "STANDARD_CONCEPT_CAPTION" : "Unknown", + "INVALID_REASON" : null, + "INVALID_REASON_CAPTION" : "Unknown", + "CONCEPT_CODE" : "LA4626-3", + "DOMAIN_ID" : "Meas Value", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : null + }, + { + "CONCEPT_ID" : 45882500, + "CONCEPT_NAME" : "M1A", + "STANDARD_CONCEPT" : null, + "STANDARD_CONCEPT_CAPTION" : "Unknown", + "INVALID_REASON" : null, + "INVALID_REASON_CAPTION" : "Unknown", + "CONCEPT_CODE" : "LA4627-1", + "DOMAIN_ID" : "Meas Value", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : null + }, + { + "CONCEPT_ID" : 45876322, + "CONCEPT_NAME" : "M1", + "STANDARD_CONCEPT" : null, + "STANDARD_CONCEPT_CAPTION" : "Unknown", + "INVALID_REASON" : null, + "INVALID_REASON_CAPTION" : "Unknown", + "CONCEPT_CODE" : "LA4628-9", + "DOMAIN_ID" : "Meas Value", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : null + } + ] } }, "StartWindow" : { @@ -5042,7 +5444,6 @@ }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -5062,9 +5463,9 @@ }, { "Criteria" : { - "ProcedureOccurrence" : { - "CodesetId" : 4, - "ProcedureTypeExclude" : false + "DrugExposure" : { + "CodesetId" : 11, + "DrugTypeExclude" : false } }, "StartWindow" : { @@ -5088,14 +5489,13 @@ }, { "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false + "ProcedureOccurrence" : { + "CodesetId" : 4, + "ProcedureTypeExclude" : false } }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -5119,36 +5519,10 @@ { "Type" : "ANY", "CriteriaList" : [ - { - "Criteria" : { - "ProcedureOccurrence" : { - "CodesetId" : 11, - "ProcedureTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 184, - "Coeff" : -1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, { "Criteria" : { "Observation" : { - "CodesetId" : 11, + "CodesetId" : 19, "ObservationTypeExclude" : false } }, @@ -5170,192 +5544,22 @@ "Count" : 1, "IsDistinct" : false } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - }, - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 18, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } }, { "Criteria" : { - "DrugExposure" : { + "ProcedureOccurrence" : { "CodesetId" : 19, - "DrugTypeExclude" : false + "ProcedureTypeExclude" : false } }, "StartWindow" : { "Start" : { - "Days" : 0, "Coeff" : -1 }, "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, + "Days" : 184, "Coeff" : -1 }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, "UseIndexEnd" : false, "UseEventEnd" : false }, @@ -5373,59 +5577,9 @@ } ] }, - "CodesetId" : 9, + "CodesetId" : 6, "First" : true, - "MeasurementTypeExclude" : false, - "ValueAsConcept" : [ - { - "CONCEPT_ID" : 45878386, - "CONCEPT_NAME" : "M1C", - "STANDARD_CONCEPT" : null, - "STANDARD_CONCEPT_CAPTION" : "Unknown", - "INVALID_REASON" : null, - "INVALID_REASON_CAPTION" : "Unknown", - "CONCEPT_CODE" : "LA4625-5", - "DOMAIN_ID" : "Meas Value", - "VOCABULARY_ID" : "LOINC", - "CONCEPT_CLASS_ID" : null - }, - { - "CONCEPT_ID" : 45881618, - "CONCEPT_NAME" : "M1B", - "STANDARD_CONCEPT" : null, - "STANDARD_CONCEPT_CAPTION" : "Unknown", - "INVALID_REASON" : null, - "INVALID_REASON_CAPTION" : "Unknown", - "CONCEPT_CODE" : "LA4626-3", - "DOMAIN_ID" : "Meas Value", - "VOCABULARY_ID" : "LOINC", - "CONCEPT_CLASS_ID" : null - }, - { - "CONCEPT_ID" : 45882500, - "CONCEPT_NAME" : "M1A", - "STANDARD_CONCEPT" : null, - "STANDARD_CONCEPT_CAPTION" : "Unknown", - "INVALID_REASON" : null, - "INVALID_REASON_CAPTION" : "Unknown", - "CONCEPT_CODE" : "LA4627-1", - "DOMAIN_ID" : "Meas Value", - "VOCABULARY_ID" : "LOINC", - "CONCEPT_CLASS_ID" : null - }, - { - "CONCEPT_ID" : 45876322, - "CONCEPT_NAME" : "M1", - "STANDARD_CONCEPT" : null, - "STANDARD_CONCEPT_CAPTION" : "Unknown", - "INVALID_REASON" : null, - "INVALID_REASON_CAPTION" : "Unknown", - "CONCEPT_CODE" : "LA4628-9", - "DOMAIN_ID" : "Meas Value", - "VOCABULARY_ID" : "LOINC", - "CONCEPT_CLASS_ID" : null - } - ] + "MeasurementTypeExclude" : false } }, "StartWindow" : { @@ -5454,48 +5608,12 @@ } ] } - }, - { - "name" : "no other primary", - "expression" : { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "ConditionOccurrence" : { - "CodesetId" : 12, - "ConditionTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 30, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } } ], "CensoringCriteria" : [ { "ConditionOccurrence" : { - "CodesetId" : 12, + "CodesetId" : 10, "ConditionTypeExclude" : false } } diff --git a/inst/cohorts/118.json b/inst/cohorts/118.json index 9cbeefa..0911149 100644 --- a/inst/cohorts/118.json +++ b/inst/cohorts/118.json @@ -4,7 +4,68 @@ "CriteriaList" : [ { "DrugExposure" : { - "CodesetId" : 13, + "CorrelatedCriteria" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 12, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 13, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + }, + "CodesetId" : 11, "OccurrenceStartDate" : { "Value" : "2016-01-01", "Op" : "bt", @@ -15,8 +76,68 @@ }, { "ProcedureOccurrence" : { + "CorrelatedCriteria" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 12, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 13, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + }, "CodesetId" : 4, - "First" : true, "OccurrenceStartDate" : { "Value" : "2016-01-01", "Op" : "bt", @@ -27,7 +148,103 @@ }, { "DrugExposure" : { - "CodesetId" : 14, + "CorrelatedCriteria" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 13, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [ + { + "Type" : "ANY", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 11, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "ProcedureOccurrence" : { + "CodesetId" : 4, + "ProcedureTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + ] + }, + "CodesetId" : 12, "OccurrenceStartDate" : { "Value" : "2016-01-01", "Op" : "bt", @@ -38,7 +255,103 @@ }, { "DrugExposure" : { - "CodesetId" : 15, + "CorrelatedCriteria" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 12, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [ + { + "Type" : "ANY", + "CriteriaList" : [ + { + "Criteria" : { + "DeviceExposure" : { + "CodesetId" : 11, + "DeviceTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "ProcedureOccurrence" : { + "CodesetId" : 4, + "ProcedureTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + ] + }, + "CodesetId" : 13, "OccurrenceStartDate" : { "Value" : "2016-01-01", "Op" : "bt", @@ -53,7 +366,7 @@ "PostDays" : 0 }, "PrimaryCriteriaLimit" : { - "Type" : "All" + "Type" : "First" } }, "ConceptSets" : [ @@ -112,6 +425,74 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264861, + "CONCEPT_NAME" : "pM1c: Distant metastasis site other than bone or non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397215009", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4264288, + "CONCEPT_NAME" : "pM1b: Distant metastasis to bone(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397214008", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4246703, + "CONCEPT_NAME" : "pM1a: Distant metastasis to non-regional lymph node(s) (prostate)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "397213002", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 763131, + "CONCEPT_NAME" : "Neoplasm of prostate distant metastasis staging category M1: Distant metastasis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "436401000124103", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false } ] } @@ -199,13 +580,13 @@ }, { "concept" : { - "CONCEPT_ID" : 4145907, - "CONCEPT_NAME" : "Orchiectomy of remaining testis", + "CONCEPT_ID" : 4304921, + "CONCEPT_NAME" : "Bilateral orchidectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "34426006", + "CONCEPT_CODE" : "386634006", "DOMAIN_ID" : "Procedure", "VOCABULARY_ID" : "SNOMED", "CONCEPT_CLASS_ID" : "Procedure" @@ -216,13 +597,13 @@ }, { "concept" : { - "CONCEPT_ID" : 4341536, - "CONCEPT_NAME" : "Total orchidectomy", + "CONCEPT_ID" : 4073142, + "CONCEPT_NAME" : "Bilateral total orchidectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "236334001", + "CONCEPT_CODE" : "176416007", "DOMAIN_ID" : "Procedure", "VOCABULARY_ID" : "SNOMED", "CONCEPT_CLASS_ID" : "Procedure" @@ -233,13 +614,98 @@ }, { "concept" : { - "CONCEPT_ID" : 35608156, - "CONCEPT_NAME" : "Excision of entire left testis by inguinal approach", + "CONCEPT_ID" : 4073143, + "CONCEPT_NAME" : "Bilateral total scrotal orchidectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "767335007", + "CONCEPT_CODE" : "176418008", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4341536, + "CONCEPT_NAME" : "Total orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "236334001", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4012324, + "CONCEPT_NAME" : "Bilateral cryptorchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "112910006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4073141, + "CONCEPT_NAME" : "Bilateral subcapsular orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176415006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4071936, + "CONCEPT_NAME" : "Bilateral total inguinal orchidectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176417003", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 35608156, + "CONCEPT_NAME" : "Excision of entire left testis by inguinal approach", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "767335007", "DOMAIN_ID" : "Procedure", "VOCABULARY_ID" : "SNOMED", "CONCEPT_CLASS_ID" : "Procedure" @@ -522,18 +988,35 @@ }, { "concept" : { - "CONCEPT_ID" : 4012324, - "CONCEPT_NAME" : "Bilateral cryptorchidectomy", + "CONCEPT_ID" : 4341536, + "CONCEPT_NAME" : "Total orchidectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "112910006", + "CONCEPT_CODE" : "236334001", "DOMAIN_ID" : "Procedure", "VOCABULARY_ID" : "SNOMED", "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : true, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4145907, + "CONCEPT_NAME" : "Orchiectomy of remaining testis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "34426006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false } @@ -583,7 +1066,7 @@ } }, { - "id" : 9, + "id" : 7, "name" : "[PIONEER 2.0] Metastasis measurement require value", "expression" : { "items" : [ @@ -608,73 +1091,73 @@ } }, { - "id" : 11, - "name" : "[Pioneer 2.0] Local trt", + "id" : 10, + "name" : "[PIONEER 2.0] other primaries", "expression" : { "items" : [ { "concept" : { - "CONCEPT_ID" : 4235738, - "CONCEPT_NAME" : "Prostatectomy", + "CONCEPT_ID" : 432851, + "CONCEPT_NAME" : "Secondary malignant neoplastic disease", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "90470006", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "128462008", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 2108677, - "CONCEPT_NAME" : "Patient counseling at a minimum on all of the following treatment options for clinically localized prostate cancer: active surveillance, and interstitial prostate brachytherapy, and external beam radiotherapy, and radical prostatectomy, provided prior to ", + "CONCEPT_ID" : 443392, + "CONCEPT_NAME" : "Malignant neoplastic disease", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "4163F", - "DOMAIN_ID" : "Observation", - "VOCABULARY_ID" : "CPT4", - "CONCEPT_CLASS_ID" : "CPT4" + "CONCEPT_CODE" : "363346000", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4216658, - "CONCEPT_NAME" : "Radical cystoprostatectomy", + "CONCEPT_ID" : 4112752, + "CONCEPT_NAME" : "Basal cell carcinoma of skin", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "81232004", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "254701007", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, - "includeDescendants" : false, + "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4306299, - "CONCEPT_NAME" : "Excision of lesion of prostate", + "CONCEPT_ID" : 4111921, + "CONCEPT_NAME" : "Squamous cell carcinoma of skin", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "83154001", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "254651007", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -682,16 +1165,16 @@ }, { "concept" : { - "CONCEPT_ID" : 4338661, - "CONCEPT_NAME" : "Complete transurethral resection of prostate, including control of postoperative bleeding", + "CONCEPT_ID" : 764971, + "CONCEPT_NAME" : "Prostate cancer metastatic to eye", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "87795007", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "96901000119105", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -699,16 +1182,16 @@ }, { "concept" : { - "CONCEPT_ID" : 3187777, - "CONCEPT_NAME" : "Cystoscopy with transurethral prostatectomy", + "CONCEPT_ID" : 36716186, + "CONCEPT_NAME" : "Hormone sensitive prostate cancer", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "21360001000004106", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "Nebraska Lexicon", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "722103009", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -716,16 +1199,16 @@ }, { "concept" : { - "CONCEPT_ID" : 40487861, - "CONCEPT_NAME" : "Endoscopic excision of prostate using holmium laser", + "CONCEPT_ID" : 200962, + "CONCEPT_NAME" : "Primary malignant neoplasm of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "446445003", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "93974005", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -733,16 +1216,16 @@ }, { "concept" : { - "CONCEPT_ID" : 4176312, - "CONCEPT_NAME" : "Endoscopic laser prostatectomy", + "CONCEPT_ID" : 36712762, + "CONCEPT_NAME" : "Recurrent malignant neoplasm of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "427985002", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "1098981000119101", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -750,16 +1233,16 @@ }, { "concept" : { - "CONCEPT_ID" : 4193061, - "CONCEPT_NAME" : "Endoscopic resection of prostate using an electrotome", + "CONCEPT_ID" : 37395835, + "CONCEPT_NAME" : "Familial prostate cancer", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "314202001", - "DOMAIN_ID" : "Procedure", + "CONCEPT_CODE" : "715412008", + "DOMAIN_ID" : "Condition", "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -767,16 +1250,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777698, - "CONCEPT_NAME" : "Excision of Prostate, Open Approach", + "CONCEPT_ID" : 4164017, + "CONCEPT_NAME" : "Squamous cell carcinoma of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB00ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "399590005", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -784,16 +1267,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777697, - "CONCEPT_NAME" : "Excision of Prostate, Open Approach, Diagnostic", + "CONCEPT_ID" : 4141960, + "CONCEPT_NAME" : "Hormone refractory prostate cancer", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB00ZX", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "427492003", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -801,16 +1284,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777700, - "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Approach", + "CONCEPT_ID" : 4163261, + "CONCEPT_NAME" : "Malignant tumor of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB03ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "399068003", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -818,16 +1301,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777699, - "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Approach, Diagnostic", + "CONCEPT_ID" : 4183913, + "CONCEPT_NAME" : "Malignant tumor involving an organ by direct extension from prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB03ZX", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "369598006", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -835,16 +1318,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777702, - "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Endoscopic Approach", + "CONCEPT_ID" : 4283614, + "CONCEPT_NAME" : "Malignant tumor involving bladder by direct extension from prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB04ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "369472002", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -852,16 +1335,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777701, - "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Endoscopic Approach, Diagnostic", + "CONCEPT_ID" : 4289246, + "CONCEPT_NAME" : "Malignant tumor involving rectum by direct extension from prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB04ZX", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "369451000", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -869,16 +1352,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777704, - "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening", + "CONCEPT_ID" : 4283740, + "CONCEPT_NAME" : "Malignant tumor involving seminal vesicle by direct extension from prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB07ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "369490001", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -886,16 +1369,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777703, - "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening, Diagnostic", + "CONCEPT_ID" : 4280897, + "CONCEPT_NAME" : "Malignant tumor involving urethra by direct extension from prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB07ZX", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "369466002", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -903,16 +1386,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2777706, - "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening Endoscopic", + "CONCEPT_ID" : 4289379, + "CONCEPT_NAME" : "Malignant tumor involving vasa deferentia by direct extension from prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB08ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "369483006", + "DOMAIN_ID" : "Condition", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Clinical Finding" }, "isExcluded" : true, "includeDescendants" : true, @@ -920,356 +1403,380 @@ }, { "concept" : { - "CONCEPT_ID" : 2777705, - "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening Endoscopic, Diagnostic", + "CONCEPT_ID" : 4312326, + "CONCEPT_NAME" : "Neoplasm, malignant (primary)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VB08ZX", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "86049000", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Morph Abnormality" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 11, + "name" : "[PIONEER V2.0] ADT (LHRH & anti-androgen)", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 44783041, - "CONCEPT_NAME" : "Holmium laser enucleation of prostate", + "CONCEPT_ID" : 19058410, + "CONCEPT_NAME" : "degarelix", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "699075006", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "475230", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4239543, - "CONCEPT_NAME" : "One stage subtotal suprapubic prostatectomy", + "CONCEPT_ID" : 739471, + "CONCEPT_NAME" : "relugolix", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "91531008", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "2472778", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 2003966, - "CONCEPT_NAME" : "Other transurethral prostatectomy", + "CONCEPT_ID" : 35834903, + "CONCEPT_NAME" : "relugolix", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "60.29", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD9Proc", - "CONCEPT_CLASS_ID" : "4-dig billing code" + "CONCEPT_CODE" : "OMOP5040508", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4021570, - "CONCEPT_NAME" : "Radical cystoprostatourethrectomy", + "CONCEPT_ID" : 1343039, + "CONCEPT_NAME" : "triptorelin", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "176106009", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "38782", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 2780477, - "CONCEPT_NAME" : "Resection of Prostate, Open Approach", + "CONCEPT_ID" : 19089810, + "CONCEPT_NAME" : "gonadorelin", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VT00ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "6384", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 2780478, - "CONCEPT_NAME" : "Resection of Prostate, Percutaneous Endoscopic Approach", + "CONCEPT_ID" : 1366310, + "CONCEPT_NAME" : "goserelin", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VT04ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "50610", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 2780479, - "CONCEPT_NAME" : "Resection of Prostate, Via Natural or Artificial Opening", + "CONCEPT_ID" : 1351541, + "CONCEPT_NAME" : "leuprolide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VT07ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "42375", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 2780480, - "CONCEPT_NAME" : "Resection of Prostate, Via Natural or Artificial Opening Endoscopic", + "CONCEPT_ID" : 1344381, + "CONCEPT_NAME" : "bicalutamide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "0VT08ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "83008", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4341384, - "CONCEPT_NAME" : "Salvage cystoprostatectomy", + "CONCEPT_ID" : 19010792, + "CONCEPT_NAME" : "cyproterone", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "236211007", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "3014", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4341893, - "CONCEPT_NAME" : "Salvage cystoprostatourethrectomy", + "CONCEPT_ID" : 1356461, + "CONCEPT_NAME" : "flutamide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "236209003", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "4508", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4212360, - "CONCEPT_NAME" : "Subtotal perineal prostatectomy", + "CONCEPT_ID" : 1500211, + "CONCEPT_NAME" : "medroxyprogesterone", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "57525009", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "6691", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4147673, - "CONCEPT_NAME" : "Subtotal prostatectomy", + "CONCEPT_ID" : 1300978, + "CONCEPT_NAME" : "megestrol", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "30426000", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "6703", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4078386, - "CONCEPT_NAME" : "Subtotal retropubic prostatectomy", + "CONCEPT_ID" : 1315286, + "CONCEPT_NAME" : "nilutamide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "19149007", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" - }, - "isExcluded" : true, + "CONCEPT_CODE" : "31805", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" + }, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4073700, - "CONCEPT_NAME" : "Transurethral laser prostatectomy", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", + "CONCEPT_ID" : 35807385, + "CONCEPT_NAME" : "GnRH agonist", + "STANDARD_CONCEPT" : "C", + "STANDARD_CONCEPT_CAPTION" : "Classification", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "176288003", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "45768", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "HemOnc", + "CONCEPT_CLASS_ID" : "Component Class" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4234536, - "CONCEPT_NAME" : "Transurethral prostatectomy", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", + "CONCEPT_ID" : 35807349, + "CONCEPT_NAME" : "GnRH antagonist", + "STANDARD_CONCEPT" : "C", + "STANDARD_CONCEPT_CAPTION" : "Classification", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "90199006", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "45632", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "HemOnc", + "CONCEPT_CLASS_ID" : "Component Class" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 12, + "name" : "[PIONEER V2.0] ARTA", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 4287859, - "CONCEPT_NAME" : "Transurethral resection of prostate, first stage of two stages", + "CONCEPT_ID" : 40239056, + "CONCEPT_NAME" : "abiraterone", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "68986004", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "1100072", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44783043, - "CONCEPT_NAME" : "Transurethral thulium laser enucleation of prostate", + "CONCEPT_ID" : 963987, + "CONCEPT_NAME" : "apalutamide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "699077003", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "1999574", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4071791, - "CONCEPT_NAME" : "Transvesical two stage prostatectomy", + "CONCEPT_ID" : 42900250, + "CONCEPT_NAME" : "enzalutamide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "176260009", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "1307298", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4054558, - "CONCEPT_NAME" : "Two stage subtotal suprapubic prostatectomy", + "CONCEPT_ID" : 1361291, + "CONCEPT_NAME" : "darolutamide", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "21190008", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "2180325", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 13, + "name" : "[PIONEER V2.0] Chemotherapy (docetaxel & cabazitaxe & paclitaxel)", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 4330932, - "CONCEPT_NAME" : "CT of prostate for radiotherapy planning", + "CONCEPT_ID" : 1315942, + "CONCEPT_NAME" : "docetaxel", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "429856001", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "72962", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -1277,16 +1784,16 @@ }, { "concept" : { - "CONCEPT_ID" : 37396025, - "CONCEPT_NAME" : "CT of prostate with contrast for radiotherapy planning", + "CONCEPT_ID" : 40222431, + "CONCEPT_NAME" : "cabazitaxel", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "715687002", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "996051", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -1294,50 +1801,66 @@ }, { "concept" : { - "CONCEPT_ID" : 2108724, - "CONCEPT_NAME" : "External beam radiotherapy as primary therapy to prostate with or without nodal irradiation (PRCA)", + "CONCEPT_ID" : 1378382, + "CONCEPT_NAME" : "paclitaxel", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "4200F", - "DOMAIN_ID" : "Observation", - "VOCABULARY_ID" : "CPT4", - "CONCEPT_CLASS_ID" : "CPT4" + "CONCEPT_CODE" : "56946", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 14, + "name" : "[PIONEER V2.0] Lutetium", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 2108725, - "CONCEPT_NAME" : "External beam radiotherapy with or without nodal irradiation as adjuvant or salvage therapy for prostate cancer patient (PRCA)", + "CONCEPT_ID" : 44816340, + "CONCEPT_NAME" : "lutetium", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "4201F", - "DOMAIN_ID" : "Observation", - "VOCABULARY_ID" : "CPT4", - "CONCEPT_CLASS_ID" : "CPT4" + "CONCEPT_CODE" : "1534772", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 15, + "name" : "[PIONEER V2.0] PARP inhibitor", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 4198015, - "CONCEPT_NAME" : "MRI of prostate for radiotherapy planning", + "CONCEPT_ID" : 45892579, + "CONCEPT_NAME" : "olaparib", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "431850000", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "1597582", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -1345,33 +1868,41 @@ }, { "concept" : { - "CONCEPT_ID" : 43533205, - "CONCEPT_NAME" : "Low dose rate (ldr) prostate brachytherapy services, composite rate", + "CONCEPT_ID" : 1718850, + "CONCEPT_NAME" : "rucaparib", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "G0458", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "HCPCS", - "CONCEPT_CLASS_ID" : "HCPCS" + "CONCEPT_CODE" : "1862579", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 16, + "name" : "[PIONEER V2.0] Immunotherapy (sipuleucel-T & pembrolizumab)", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 2790073, - "CONCEPT_NAME" : "Contact Radiation of Prostate", + "CONCEPT_ID" : 586622, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DVY07ZZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP3138293", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -1379,16 +1910,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1781260, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Cesium 131 (Cs-131)", + "CONCEPT_ID" : 587503, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10B6Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP3136350", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Clinical Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -1396,33 +1927,33 @@ }, { "concept" : { - "CONCEPT_ID" : 4041984, - "CONCEPT_NAME" : "Laser ablation of prostate", + "CONCEPT_ID" : 784328, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] Box of 1 by MSD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "118164001", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" - }, - "isExcluded" : false, - "includeDescendants" : true, + "CONCEPT_CODE" : "OMOP4832151", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" + }, + "isExcluded" : false, + "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 2789856, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Other Isotope", + "CONCEPT_ID" : 1830614, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Abacus Medicine", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10BYZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP5155867", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1430,16 +1961,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1524039, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Palladium 103 (Pd-103), Unidirectional Source", + "CONCEPT_ID" : 1832328, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by Abacus Medicine", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10BB1", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP5157569", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1447,16 +1978,16 @@ }, { "concept" : { - "CONCEPT_ID" : 37111533, - "CONCEPT_NAME" : "Ultrasonography guided transrectal cryoablation of prostate", + "CONCEPT_ID" : 21021970, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] Box of 1 by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "726544002", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "OMOP344279", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1464,16 +1995,16 @@ }, { "concept" : { - "CONCEPT_ID" : 4061656, - "CONCEPT_NAME" : "Microwave therapy to prostate", + "CONCEPT_ID" : 21090575, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "169429005", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "OMOP344278", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -1481,16 +2012,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789850, - "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Other Isotope", + "CONCEPT_ID" : 21120047, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV109YZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP344275", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -1498,16 +2029,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789851, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Cesium 137 (Cs-137)", + "CONCEPT_ID" : 21159533, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10B7Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP344277", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1515,16 +2046,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789848, - "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Palladium 103 (Pd-103)", + "CONCEPT_ID" : 35129163, + "CONCEPT_NAME" : "0.8 ML pembrolizumab 25 MG/ML Injectable Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV109BZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP4786432", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -1532,16 +2063,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789849, - "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Californium 252 (Cf-252)", + "CONCEPT_ID" : 35139888, + "CONCEPT_NAME" : "0.8 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV109CZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP4797037", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -1549,16 +2080,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789854, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Palladium 103 (Pd-103)", + "CONCEPT_ID" : 35604048, + "CONCEPT_NAME" : "sipuleucel-T Injection", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10BBZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "1726181", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -1566,16 +2097,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789855, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Californium 252 (Cf-252)", + "CONCEPT_ID" : 35604049, + "CONCEPT_NAME" : "sipuleucel-T Injection [Provenge]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10BCZ", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "1726183", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -1583,16 +2114,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789852, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Iridium 192 (Ir-192)", + "CONCEPT_ID" : 35604050, + "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML Injection", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10B8Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "1726185", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -1600,16 +2131,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789853, - "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Iodine 125 (I-125)", + "CONCEPT_ID" : 35604051, + "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML Injection [Provenge]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV10B9Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "1726186", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -1617,16 +2148,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789846, - "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Iridium 192 (Ir-192)", + "CONCEPT_ID" : 35803678, + "CONCEPT_NAME" : "Pembrolizumab monotherapy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV1098Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "3199", + "DOMAIN_ID" : "Regimen", + "VOCABULARY_ID" : "HemOnc", + "CONCEPT_CLASS_ID" : "Regimen" }, "isExcluded" : false, "includeDescendants" : true, @@ -1634,16 +2165,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789847, - "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Iodine 125 (I-125)", + "CONCEPT_ID" : 36056039, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] Box of 1 by Originalis B.V.", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV1099Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP4981443", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1651,16 +2182,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2789845, - "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Cesium 137 (Cs-137)", + "CONCEPT_ID" : 36056040, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by Originalis B.V.", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "DV1097Z", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "ICD10PCS", - "CONCEPT_CLASS_ID" : "ICD10PCS" + "CONCEPT_CODE" : "OMOP4981444", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1668,16 +2199,16 @@ }, { "concept" : { - "CONCEPT_ID" : 759648, - "CONCEPT_NAME" : "Ablation of malignant prostate tissue, transrectal, with high intensity-focused ultrasound (HIFU), including ultrasound guidance", + "CONCEPT_ID" : 36065121, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] Box of 1 by Originalis B.V.", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "55880", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "CPT4", - "CONCEPT_CLASS_ID" : "CPT4" + "CONCEPT_CODE" : "OMOP4991393", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1685,16 +2216,16 @@ }, { "concept" : { - "CONCEPT_ID" : 4073126, - "CONCEPT_NAME" : "Cryotherapy to prostate via perineal probe", + "CONCEPT_ID" : 36065122, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Originalis B.V.", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "176319004", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "OMOP4991394", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -1702,16 +2233,16 @@ }, { "concept" : { - "CONCEPT_ID" : 2110047, - "CONCEPT_NAME" : "Transperineal placement of needles or catheters into prostate for interstitial radioelement application, with or without cystoscopy", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", + "CONCEPT_ID" : 36224401, + "CONCEPT_NAME" : "sipuleucel-T Injectable Product", + "STANDARD_CONCEPT" : "C", + "STANDARD_CONCEPT_CAPTION" : "Classification", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "55875", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "CPT4", - "CONCEPT_CLASS_ID" : "CPT4" + "CONCEPT_CODE" : "1159660", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Dose Group" }, "isExcluded" : false, "includeDescendants" : true, @@ -1719,58 +2250,50 @@ }, { "concept" : { - "CONCEPT_ID" : 37111533, - "CONCEPT_NAME" : "Ultrasonography guided transrectal cryoablation of prostate", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", + "CONCEPT_ID" : 36238934, + "CONCEPT_NAME" : "Provenge Injectable Product", + "STANDARD_CONCEPT" : "C", + "STANDARD_CONCEPT_CAPTION" : "Classification", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "726544002", - "DOMAIN_ID" : "Procedure", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Procedure" + "CONCEPT_CODE" : "1182470", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Dose Group" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 12, - "name" : "[PIONEER 2.0] other primaries", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 432851, - "CONCEPT_NAME" : "Secondary malignant neoplastic disease", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", + "CONCEPT_ID" : 36247443, + "CONCEPT_NAME" : "pembrolizumab Injectable Product", + "STANDARD_CONCEPT" : "C", + "STANDARD_CONCEPT_CAPTION" : "Classification", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "128462008", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "1547547", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Dose Group" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 443392, - "CONCEPT_NAME" : "Malignant neoplastic disease", - "STANDARD_CONCEPT" : "S", - "STANDARD_CONCEPT_CAPTION" : "Standard", + "CONCEPT_ID" : 36247444, + "CONCEPT_NAME" : "Keytruda Injectable Product", + "STANDARD_CONCEPT" : "C", + "STANDARD_CONCEPT_CAPTION" : "Classification", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "363346000", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "1547553", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Dose Group" }, "isExcluded" : false, "includeDescendants" : true, @@ -1778,296 +2301,288 @@ }, { "concept" : { - "CONCEPT_ID" : 4112752, - "CONCEPT_NAME" : "Basal cell carcinoma of skin", + "CONCEPT_ID" : 36271591, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] by MSD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "254701007", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP3122466", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4111921, - "CONCEPT_NAME" : "Squamous cell carcinoma of skin", + "CONCEPT_ID" : 36278763, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda] by MSD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "254651007", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP3129638", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 764971, - "CONCEPT_NAME" : "Prostate cancer metastatic to eye", + "CONCEPT_ID" : 36404396, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "96901000119105", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP3096438", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36716186, - "CONCEPT_NAME" : "Hormone sensitive prostate cancer", + "CONCEPT_ID" : 36405170, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "722103009", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP3097212", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 200962, - "CONCEPT_NAME" : "Primary malignant neoplasm of prostate", + "CONCEPT_ID" : 36780945, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution [Keytruda] Box of 1 by MSD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "93974005", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4769239", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36712762, - "CONCEPT_NAME" : "Recurrent malignant neoplasm of prostate", + "CONCEPT_ID" : 36780946, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1098981000119101", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4769240", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Branded Box" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 37395835, - "CONCEPT_NAME" : "Familial prostate cancer", + "CONCEPT_ID" : 36780947, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "715412008", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4769241", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Branded Drug" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4164017, - "CONCEPT_NAME" : "Squamous cell carcinoma of prostate", + "CONCEPT_ID" : 36780948, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "399590005", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4769242", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Clinical Box" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4141960, - "CONCEPT_NAME" : "Hormone refractory prostate cancer", + "CONCEPT_ID" : 36780949, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "427492003", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4769243", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Clinical Drug" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4163261, - "CONCEPT_NAME" : "Malignant tumor of prostate", + "CONCEPT_ID" : 36787995, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "399068003", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776257", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4183913, - "CONCEPT_NAME" : "Malignant tumor involving an organ by direct extension from prostate", + "CONCEPT_ID" : 36787996, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "369598006", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776258", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4283614, - "CONCEPT_NAME" : "Malignant tumor involving bladder by direct extension from prostate", + "CONCEPT_ID" : 36787997, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "369472002", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776259", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4289246, - "CONCEPT_NAME" : "Malignant tumor involving rectum by direct extension from prostate", + "CONCEPT_ID" : 36787998, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "369451000", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776260", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4283740, - "CONCEPT_NAME" : "Malignant tumor involving seminal vesicle by direct extension from prostate", + "CONCEPT_ID" : 36787999, + "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution [Keytruda] Box of 1 by MSD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "369490001", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776261", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4280897, - "CONCEPT_NAME" : "Malignant tumor involving urethra by direct extension from prostate", + "CONCEPT_ID" : 36788000, + "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "369466002", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776262", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 4289379, - "CONCEPT_NAME" : "Malignant tumor involving vasa deferentia by direct extension from prostate", + "CONCEPT_ID" : 36788001, + "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "369483006", - "DOMAIN_ID" : "Condition", - "VOCABULARY_ID" : "SNOMED", - "CONCEPT_CLASS_ID" : "Clinical Finding" + "CONCEPT_CODE" : "OMOP4776263", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug" }, - "isExcluded" : true, + "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 13, - "name" : "[PIONEER V2.0] ADT (LHRH & anti-androgen)", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 19058410, - "CONCEPT_NAME" : "degarelix", + "CONCEPT_ID" : 36788002, + "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "475230", + "CONCEPT_CODE" : "OMOP4776264", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2075,16 +2590,16 @@ }, { "concept" : { - "CONCEPT_ID" : 739471, - "CONCEPT_NAME" : "relugolix", + "CONCEPT_ID" : 36788003, + "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "2472778", + "CONCEPT_CODE" : "OMOP4776265", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2092,16 +2607,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35834903, - "CONCEPT_NAME" : "relugolix", + "CONCEPT_ID" : 36788004, + "CONCEPT_NAME" : "pembrolizumab Intravenous Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP5040508", + "CONCEPT_CODE" : "OMOP4776266", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CLASS_ID" : "Branded Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2109,16 +2624,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1343039, - "CONCEPT_NAME" : "triptorelin", + "CONCEPT_ID" : 36788005, + "CONCEPT_NAME" : "pembrolizumab Intravenous Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "38782", + "CONCEPT_CODE" : "OMOP4776267", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2126,16 +2641,16 @@ }, { "concept" : { - "CONCEPT_ID" : 19089810, - "CONCEPT_NAME" : "gonadorelin", + "CONCEPT_ID" : 36879366, + "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "6384", + "CONCEPT_CODE" : "OMOP995343", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2143,16 +2658,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1366310, - "CONCEPT_NAME" : "goserelin", + "CONCEPT_ID" : 36880201, + "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "50610", + "CONCEPT_CODE" : "OMOP1005850", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2160,16 +2675,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1351541, - "CONCEPT_NAME" : "leuprolide", + "CONCEPT_ID" : 36885115, + "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "42375", + "CONCEPT_CODE" : "OMOP989456", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2177,16 +2692,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1344381, - "CONCEPT_NAME" : "bicalutamide", + "CONCEPT_ID" : 36889553, + "CONCEPT_NAME" : "pembrolizumab Prefilled Syringe", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "83008", + "CONCEPT_CODE" : "OMOP998887", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2194,16 +2709,16 @@ }, { "concept" : { - "CONCEPT_ID" : 19010792, - "CONCEPT_NAME" : "cyproterone", + "CONCEPT_ID" : 36889599, + "CONCEPT_NAME" : "pembrolizumab Prefilled Syringe [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "3014", + "CONCEPT_CODE" : "OMOP1005312", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2211,16 +2726,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1356461, - "CONCEPT_NAME" : "flutamide", + "CONCEPT_ID" : 36892847, + "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "4508", + "CONCEPT_CODE" : "OMOP991291", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2228,16 +2743,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1500211, - "CONCEPT_NAME" : "medroxyprogesterone", + "CONCEPT_ID" : 37592548, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] by HVD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "6691", + "CONCEPT_CODE" : "OMOP4781994", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -2245,16 +2760,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1300978, - "CONCEPT_NAME" : "megestrol", + "CONCEPT_ID" : 40224085, + "CONCEPT_NAME" : "250 ML sipuleucel-T 200000 CELLS/ML Injection [Provenge]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "6703", + "CONCEPT_CODE" : "997267", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CLASS_ID" : "Quant Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2262,16 +2777,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1315286, - "CONCEPT_NAME" : "nilutamide", + "CONCEPT_ID" : 40224086, + "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML [Provenge]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "31805", + "CONCEPT_CODE" : "997265", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CLASS_ID" : "Branded Drug Comp" }, "isExcluded" : false, "includeDescendants" : true, @@ -2279,16 +2794,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35807385, - "CONCEPT_NAME" : "GnRH agonist", - "STANDARD_CONCEPT" : "C", - "STANDARD_CONCEPT_CAPTION" : "Classification", + "CONCEPT_ID" : 40224095, + "CONCEPT_NAME" : "sipuleucel-T", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "45768", + "CONCEPT_CODE" : "997261", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "HemOnc", - "CONCEPT_CLASS_ID" : "Component Class" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -2296,41 +2811,33 @@ }, { "concept" : { - "CONCEPT_ID" : 35807349, - "CONCEPT_NAME" : "GnRH antagonist", - "STANDARD_CONCEPT" : "C", - "STANDARD_CONCEPT_CAPTION" : "Classification", + "CONCEPT_ID" : 40224096, + "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "45632", + "CONCEPT_CODE" : "997262", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "HemOnc", - "CONCEPT_CLASS_ID" : "Component Class" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Drug Comp" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 14, - "name" : "[PIONEER V2.0] ARTA", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 40239056, - "CONCEPT_NAME" : "abiraterone", + "CONCEPT_ID" : 40224097, + "CONCEPT_NAME" : "250 ML sipuleucel-T 200000 CELLS/ML Injection", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1100072", + "CONCEPT_CODE" : "997264", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CLASS_ID" : "Quant Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2338,16 +2845,16 @@ }, { "concept" : { - "CONCEPT_ID" : 963987, - "CONCEPT_NAME" : "apalutamide", + "CONCEPT_ID" : 40716385, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1999574", + "CONCEPT_CODE" : "OMOP4740730", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -2355,16 +2862,16 @@ }, { "concept" : { - "CONCEPT_ID" : 42900250, - "CONCEPT_NAME" : "enzalutamide", + "CONCEPT_ID" : 40745552, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] Box of 1 by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1307298", + "CONCEPT_CODE" : "OMOP4711640", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -2372,41 +2879,33 @@ }, { "concept" : { - "CONCEPT_ID" : 1361291, - "CONCEPT_NAME" : "darolutamide", + "CONCEPT_ID" : 40745553, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "2180325", + "CONCEPT_CODE" : "OMOP4711639", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 15, - "name" : "[PIONEER V2.0] Chemotherapy (docetaxel & cabazitaxe & paclitaxel)", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 1315942, - "CONCEPT_NAME" : "docetaxel", + "CONCEPT_ID" : 40745554, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "72962", + "CONCEPT_CODE" : "OMOP4711638", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -2414,16 +2913,16 @@ }, { "concept" : { - "CONCEPT_ID" : 40222431, - "CONCEPT_NAME" : "cabazitaxel", + "CONCEPT_ID" : 40745555, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "996051", + "CONCEPT_CODE" : "OMOP4711637", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2431,66 +2930,50 @@ }, { "concept" : { - "CONCEPT_ID" : 1378382, - "CONCEPT_NAME" : "paclitaxel", + "CONCEPT_ID" : 41079944, + "CONCEPT_NAME" : "sipuleucel-T Injectable Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "56946", + "CONCEPT_CODE" : "OMOP2277906", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 16, - "name" : "[PIONEER V2.0] Lutetium", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 44816340, - "CONCEPT_NAME" : "lutetium", + "CONCEPT_ID" : 41122672, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1534772", + "CONCEPT_CODE" : "OMOP2320634", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 17, - "name" : "[PIONEER V2.0] PARP inhibitor", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 45892579, - "CONCEPT_NAME" : "olaparib", + "CONCEPT_ID" : 41133743, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] Box of 1 by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1597582", + "CONCEPT_CODE" : "OMOP2331705", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -2498,41 +2981,33 @@ }, { "concept" : { - "CONCEPT_ID" : 1718850, - "CONCEPT_NAME" : "rucaparib", + "CONCEPT_ID" : 41271431, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1862579", + "CONCEPT_CODE" : "OMOP2469393", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 18, - "name" : "[PIONEER V2.0] Immunotherapy (sipuleucel-T & pembrolizumab)", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 586622, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection Box of 1", + "CONCEPT_ID" : 42658251, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by MSD", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3138293", + "CONCEPT_CODE" : "OMOP4869815", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "CONCEPT_CLASS_ID" : "Marketed Product" }, "isExcluded" : false, "includeDescendants" : true, @@ -2540,16 +3015,16 @@ }, { "concept" : { - "CONCEPT_ID" : 587503, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection Box of 1", + "CONCEPT_ID" : 42921578, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3136350", + "CONCEPT_CODE" : "OMOP4648403", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Clinical Box" + "CONCEPT_CLASS_ID" : "Quant Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2557,16 +3032,16 @@ }, { "concept" : { - "CONCEPT_ID" : 784328, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] Box of 1 by MSD", + "CONCEPT_ID" : 42963145, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injectable Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4832151", + "CONCEPT_CODE" : "OMOP4689628", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2574,16 +3049,16 @@ }, { "concept" : { - "CONCEPT_ID" : 1830614, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Abacus Medicine", + "CONCEPT_ID" : 42963146, + "CONCEPT_NAME" : "pembrolizumab Injectable Solution [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP5155867", + "CONCEPT_CODE" : "OMOP4689629", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CLASS_ID" : "Branded Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2591,13 +3066,13 @@ }, { "concept" : { - "CONCEPT_ID" : 1832328, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by Abacus Medicine", + "CONCEPT_ID" : 43173544, + "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe [Keytruda] Box of 1 by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP5157569", + "CONCEPT_CODE" : "OMOP496837", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", "CONCEPT_CLASS_ID" : "Marketed Product" @@ -2608,13 +3083,13 @@ }, { "concept" : { - "CONCEPT_ID" : 21021970, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] Box of 1 by Merck", + "CONCEPT_ID" : 44075484, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP344279", + "CONCEPT_CODE" : "OMOP1070115", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", "CONCEPT_CLASS_ID" : "Marketed Product" @@ -2625,16 +3100,16 @@ }, { "concept" : { - "CONCEPT_ID" : 21090575, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] Box of 1", + "CONCEPT_ID" : 44081458, + "CONCEPT_NAME" : "pembrolizumab Injectable Suspension", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP344278", + "CONCEPT_CODE" : "OMOP1076089", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2642,16 +3117,16 @@ }, { "concept" : { - "CONCEPT_ID" : 21120047, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection Box of 1", + "CONCEPT_ID" : 44082527, + "CONCEPT_NAME" : "pembrolizumab Injectable Suspension [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP344275", + "CONCEPT_CODE" : "OMOP1077158", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "CONCEPT_CLASS_ID" : "Branded Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2659,16 +3134,16 @@ }, { "concept" : { - "CONCEPT_ID" : 21159533, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] by Merck", + "CONCEPT_ID" : 44084103, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP344277", + "CONCEPT_CODE" : "OMOP1078734", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2676,16 +3151,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35129163, - "CONCEPT_NAME" : "0.8 ML pembrolizumab 25 MG/ML Injectable Solution", + "CONCEPT_ID" : 44124784, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4786432", + "CONCEPT_CODE" : "OMOP1119415", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Clinical Drug" + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2693,16 +3168,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35139888, - "CONCEPT_NAME" : "0.8 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda]", + "CONCEPT_ID" : 44164861, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injectable Solution Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4797037", + "CONCEPT_CODE" : "OMOP3041584", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Branded Drug" + "CONCEPT_CLASS_ID" : "Clinical Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2710,16 +3185,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35604048, - "CONCEPT_NAME" : "sipuleucel-T Injection", + "CONCEPT_ID" : 44164862, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injectable Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1726181", + "CONCEPT_CODE" : "OMOP3041585", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2727,16 +3202,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35604049, - "CONCEPT_NAME" : "sipuleucel-T Injection [Provenge]", + "CONCEPT_ID" : 44175744, + "CONCEPT_NAME" : "pembrolizumab Injectable Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1726183", + "CONCEPT_CODE" : "OMOP3052467", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug Form" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2744,16 +3219,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35604050, - "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML Injection", + "CONCEPT_ID" : 44184353, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1726185", + "CONCEPT_CODE" : "OMOP3061076", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Branded Drug Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2761,16 +3236,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35604051, - "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML Injection [Provenge]", + "CONCEPT_ID" : 44191541, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda] Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1726186", + "CONCEPT_CODE" : "OMOP3068264", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug" + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Branded Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2778,16 +3253,16 @@ }, { "concept" : { - "CONCEPT_ID" : 35803678, - "CONCEPT_NAME" : "Pembrolizumab monotherapy", + "CONCEPT_ID" : 44191562, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "3199", - "DOMAIN_ID" : "Regimen", - "VOCABULARY_ID" : "HemOnc", - "CONCEPT_CLASS_ID" : "Regimen" + "CONCEPT_CODE" : "OMOP3068285", + "DOMAIN_ID" : "Drug", + "VOCABULARY_ID" : "RxNorm Extension", + "CONCEPT_CLASS_ID" : "Quant Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2795,16 +3270,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36056039, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] Box of 1 by Originalis B.V.", + "CONCEPT_ID" : 44191588, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution Box of 1", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4981443", + "CONCEPT_CODE" : "OMOP3068311", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CLASS_ID" : "Quant Clinical Box" }, "isExcluded" : false, "includeDescendants" : true, @@ -2812,13 +3287,13 @@ }, { "concept" : { - "CONCEPT_ID" : 36056040, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by Originalis B.V.", + "CONCEPT_ID" : 44191599, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda] Box of 1 by Merck", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4981444", + "CONCEPT_CODE" : "OMOP3068322", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", "CONCEPT_CLASS_ID" : "Marketed Product" @@ -2829,16 +3304,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36065121, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] Box of 1 by Originalis B.V.", + "CONCEPT_ID" : 45775965, + "CONCEPT_NAME" : "pembrolizumab", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4991393", + "CONCEPT_CODE" : "1547545", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -2846,16 +3321,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36065122, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Originalis B.V.", + "CONCEPT_ID" : 45775966, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4991394", + "CONCEPT_CODE" : "1547546", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Drug Comp" }, "isExcluded" : false, "includeDescendants" : true, @@ -2863,16 +3338,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36224401, - "CONCEPT_NAME" : "sipuleucel-T Injectable Product", - "STANDARD_CONCEPT" : "C", - "STANDARD_CONCEPT_CAPTION" : "Classification", + "CONCEPT_ID" : 45775970, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML [Keytruda]", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1159660", + "CONCEPT_CODE" : "1547551", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Dose Group" + "CONCEPT_CLASS_ID" : "Branded Drug Comp" }, "isExcluded" : false, "includeDescendants" : true, @@ -2880,16 +3355,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36238934, - "CONCEPT_NAME" : "Provenge Injectable Product", - "STANDARD_CONCEPT" : "C", - "STANDARD_CONCEPT_CAPTION" : "Classification", + "CONCEPT_ID" : 46276407, + "CONCEPT_NAME" : "pembrolizumab 50 MG", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1182470", + "CONCEPT_CODE" : "1657744", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Dose Group" + "CONCEPT_CLASS_ID" : "Clinical Drug Comp" }, "isExcluded" : false, "includeDescendants" : true, @@ -2897,16 +3372,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36247443, - "CONCEPT_NAME" : "pembrolizumab Injectable Product", - "STANDARD_CONCEPT" : "C", - "STANDARD_CONCEPT_CAPTION" : "Classification", + "CONCEPT_ID" : 46276408, + "CONCEPT_NAME" : "pembrolizumab Injection", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1547547", + "CONCEPT_CODE" : "1657745", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Dose Group" + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2914,16 +3389,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36247444, - "CONCEPT_NAME" : "Keytruda Injectable Product", - "STANDARD_CONCEPT" : "C", - "STANDARD_CONCEPT_CAPTION" : "Classification", + "CONCEPT_ID" : 46276409, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1547553", + "CONCEPT_CODE" : "1657746", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Dose Group" + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2931,16 +3406,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36271591, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda] by MSD", + "CONCEPT_ID" : 46276410, + "CONCEPT_NAME" : "pembrolizumab 50 MG [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3122466", + "CONCEPT_CODE" : "1657747", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Drug Comp" }, "isExcluded" : false, "includeDescendants" : true, @@ -2948,16 +3423,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36278763, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda] by MSD", + "CONCEPT_ID" : 46276411, + "CONCEPT_NAME" : "pembrolizumab Injection [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3129638", + "CONCEPT_CODE" : "1657748", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Drug Form" }, "isExcluded" : false, "includeDescendants" : true, @@ -2965,16 +3440,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36404396, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution Box of 1", + "CONCEPT_ID" : 46276412, + "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3096438", + "CONCEPT_CODE" : "1657749", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2982,16 +3457,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36405170, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution", + "CONCEPT_ID" : 46276413, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3097212", + "CONCEPT_CODE" : "1657750", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Quant Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -2999,16 +3474,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36780945, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution [Keytruda] Box of 1 by MSD", + "CONCEPT_ID" : 46276414, + "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4769239", + "CONCEPT_CODE" : "1657751", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Quant Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -3016,16 +3491,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36780946, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution [Keytruda] Box of 1", + "CONCEPT_ID" : 46276415, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4769240", + "CONCEPT_CODE" : "1657752", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Branded Box" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Clinical Drug" }, "isExcluded" : false, "includeDescendants" : true, @@ -3033,33 +3508,41 @@ }, { "concept" : { - "CONCEPT_ID" : 36780947, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution [Keytruda]", + "CONCEPT_ID" : 46276416, + "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection [Keytruda]", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4769241", + "CONCEPT_CODE" : "1657753", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Branded Drug" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Branded Drug" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 17, + "name" : "[PIONEER V2.0] Radium-223", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 36780948, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution Box of 1", + "CONCEPT_ID" : 45775578, + "CONCEPT_NAME" : "radium", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4769242", + "CONCEPT_CODE" : "1546450", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Clinical Box" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -3067,16 +3550,16 @@ }, { "concept" : { - "CONCEPT_ID" : 36780949, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Intravenous Solution", + "CONCEPT_ID" : 902727, + "CONCEPT_NAME" : "Radium-223", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4769243", + "CONCEPT_CODE" : "OMOP5042947", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Clinical Drug" + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, @@ -3084,50 +3567,58 @@ }, { "concept" : { - "CONCEPT_ID" : 36787995, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution [Keytruda] Box of 1", + "CONCEPT_ID" : 41267222, + "CONCEPT_NAME" : "Radium Oral Solution", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776257", + "CONCEPT_CODE" : "OMOP2465184", "DOMAIN_ID" : "Drug", "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CLASS_ID" : "Clinical Drug Form" }, - "isExcluded" : false, - "includeDescendants" : true, + "isExcluded" : true, + "includeDescendants" : false, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36787996, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution [Keytruda]", + "CONCEPT_ID" : 43526934, + "CONCEPT_NAME" : "radium chloride Ra-223", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776258", + "CONCEPT_CODE" : "1424174", "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug" + "VOCABULARY_ID" : "RxNorm", + "CONCEPT_CLASS_ID" : "Ingredient" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 18, + "name" : "[PIONEER 2.0] Hx of prostate cancer", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 36787997, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution Box of 1", + "CONCEPT_ID" : 3169330, + "CONCEPT_NAME" : "Personal history of prostate cancer", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776259", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "CONCEPT_CODE" : "4220001000004104", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "Nebraska Lexicon", + "CONCEPT_CLASS_ID" : "Context-dependent" }, "isExcluded" : false, "includeDescendants" : true, @@ -3135,33 +3626,41 @@ }, { "concept" : { - "CONCEPT_ID" : 36787998, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Intravenous Solution", + "CONCEPT_ID" : 4180749, + "CONCEPT_NAME" : "History of malignant neoplasm of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776260", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "428262008", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Context-dependent" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - }, + } + ] + } + }, + { + "id" : 19, + "name" : "[Pioneer 2.0] Local trt", + "expression" : { + "items" : [ { "concept" : { - "CONCEPT_ID" : 36787999, - "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution [Keytruda] Box of 1 by MSD", + "CONCEPT_ID" : 4235738, + "CONCEPT_NAME" : "Prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776261", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "90470006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -3169,645 +3668,645 @@ }, { "concept" : { - "CONCEPT_ID" : 36788000, - "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution [Keytruda] Box of 1", + "CONCEPT_ID" : 2108677, + "CONCEPT_NAME" : "Patient counseling at a minimum on all of the following treatment options for clinically localized prostate cancer: active surveillance, and interstitial prostate brachytherapy, and external beam radiotherapy, and radical prostatectomy, provided prior to ", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776262", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CODE" : "4163F", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36788001, - "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution [Keytruda]", + "CONCEPT_ID" : 4216658, + "CONCEPT_NAME" : "Radical cystoprostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776263", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "81232004", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, - "includeDescendants" : true, + "isExcluded" : true, + "includeDescendants" : false, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36788002, - "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution Box of 1", + "CONCEPT_ID" : 4306299, + "CONCEPT_NAME" : "Excision of lesion of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776264", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "CONCEPT_CODE" : "83154001", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36788003, - "CONCEPT_NAME" : "pembrolizumab 50 MG Intravenous Solution", + "CONCEPT_ID" : 4338661, + "CONCEPT_NAME" : "Complete transurethral resection of prostate, including control of postoperative bleeding", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776265", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "87795007", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36788004, - "CONCEPT_NAME" : "pembrolizumab Intravenous Solution [Keytruda]", + "CONCEPT_ID" : 3187777, + "CONCEPT_NAME" : "Cystoscopy with transurethral prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776266", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Form" + "CONCEPT_CODE" : "21360001000004106", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "Nebraska Lexicon", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36788005, - "CONCEPT_NAME" : "pembrolizumab Intravenous Solution", + "CONCEPT_ID" : 40487861, + "CONCEPT_NAME" : "Endoscopic excision of prostate using holmium laser", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4776267", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "446445003", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36879366, - "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe [Keytruda]", + "CONCEPT_ID" : 4176312, + "CONCEPT_NAME" : "Endoscopic laser prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP995343", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "427985002", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36880201, - "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe Box of 1", + "CONCEPT_ID" : 4193061, + "CONCEPT_NAME" : "Endoscopic resection of prostate using an electrotome", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1005850", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "CONCEPT_CODE" : "314202001", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36885115, - "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe [Keytruda] Box of 1", + "CONCEPT_ID" : 2777698, + "CONCEPT_NAME" : "Excision of Prostate, Open Approach", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP989456", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CODE" : "0VB00ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36889553, - "CONCEPT_NAME" : "pembrolizumab Prefilled Syringe", + "CONCEPT_ID" : 2777697, + "CONCEPT_NAME" : "Excision of Prostate, Open Approach, Diagnostic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP998887", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "0VB00ZX", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36889599, - "CONCEPT_NAME" : "pembrolizumab Prefilled Syringe [Keytruda]", + "CONCEPT_ID" : 2777700, + "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Approach", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1005312", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Form" + "CONCEPT_CODE" : "0VB03ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 36892847, - "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe", + "CONCEPT_ID" : 2777699, + "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Approach, Diagnostic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP991291", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "0VB03ZX", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 37592548, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] by HVD", + "CONCEPT_ID" : 2777702, + "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Endoscopic Approach", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4781994", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "0VB04ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40224085, - "CONCEPT_NAME" : "250 ML sipuleucel-T 200000 CELLS/ML Injection [Provenge]", + "CONCEPT_ID" : 2777701, + "CONCEPT_NAME" : "Excision of Prostate, Percutaneous Endoscopic Approach, Diagnostic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "997267", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Quant Branded Drug" + "CONCEPT_CODE" : "0VB04ZX", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40224086, - "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML [Provenge]", + "CONCEPT_ID" : 2777704, + "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "997265", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug Comp" + "CONCEPT_CODE" : "0VB07ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40224095, - "CONCEPT_NAME" : "sipuleucel-T", + "CONCEPT_ID" : 2777703, + "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening, Diagnostic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "997261", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CODE" : "0VB07ZX", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40224096, - "CONCEPT_NAME" : "sipuleucel-T 200000 CELLS/ML", + "CONCEPT_ID" : 2777706, + "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening Endoscopic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "997262", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug Comp" + "CONCEPT_CODE" : "0VB08ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40224097, - "CONCEPT_NAME" : "250 ML sipuleucel-T 200000 CELLS/ML Injection", + "CONCEPT_ID" : 2777705, + "CONCEPT_NAME" : "Excision of Prostate, Via Natural or Artificial Opening Endoscopic, Diagnostic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "997264", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Quant Clinical Drug" + "CONCEPT_CODE" : "0VB08ZX", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40716385, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by Merck", + "CONCEPT_ID" : 44783041, + "CONCEPT_NAME" : "Holmium laser enucleation of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4740730", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "699075006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40745552, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] Box of 1 by Merck", + "CONCEPT_ID" : 4239543, + "CONCEPT_NAME" : "One stage subtotal suprapubic prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4711640", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "91531008", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40745553, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] Box of 1", + "CONCEPT_ID" : 2003966, + "CONCEPT_NAME" : "Other transurethral prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4711639", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CODE" : "60.29", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD9Proc", + "CONCEPT_CLASS_ID" : "4-dig billing code" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40745554, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda] by Merck", + "CONCEPT_ID" : 4021570, + "CONCEPT_NAME" : "Radical cystoprostatourethrectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4711638", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "176106009", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 40745555, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Solution [Keytruda]", + "CONCEPT_ID" : 2780477, + "CONCEPT_NAME" : "Resection of Prostate, Open Approach", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4711637", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "0VT00ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 41079944, - "CONCEPT_NAME" : "sipuleucel-T Injectable Solution", + "CONCEPT_ID" : 2780478, + "CONCEPT_NAME" : "Resection of Prostate, Percutaneous Endoscopic Approach", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP2277906", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "0VT04ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 41122672, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] Box of 1", + "CONCEPT_ID" : 2780479, + "CONCEPT_NAME" : "Resection of Prostate, Via Natural or Artificial Opening", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP2320634", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CODE" : "0VT07ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 41133743, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] Box of 1 by Merck", + "CONCEPT_ID" : 2780480, + "CONCEPT_NAME" : "Resection of Prostate, Via Natural or Artificial Opening Endoscopic", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP2331705", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "0VT08ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 41271431, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension Box of 1", + "CONCEPT_ID" : 4341384, + "CONCEPT_NAME" : "Salvage cystoprostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP2469393", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "CONCEPT_CODE" : "236211007", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 42658251, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda] by MSD", + "CONCEPT_ID" : 4341893, + "CONCEPT_NAME" : "Salvage cystoprostatourethrectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4869815", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "236209003", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 42921578, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution [Keytruda]", + "CONCEPT_ID" : 4212360, + "CONCEPT_NAME" : "Subtotal perineal prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4648403", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Branded Drug" + "CONCEPT_CODE" : "57525009", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 42963145, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injectable Solution [Keytruda]", + "CONCEPT_ID" : 4147673, + "CONCEPT_NAME" : "Subtotal prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4689628", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "30426000", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 42963146, - "CONCEPT_NAME" : "pembrolizumab Injectable Solution [Keytruda]", + "CONCEPT_ID" : 4078386, + "CONCEPT_NAME" : "Subtotal retropubic prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP4689629", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Form" + "CONCEPT_CODE" : "19149007", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 43173544, - "CONCEPT_NAME" : "pembrolizumab 50 MG Prefilled Syringe [Keytruda] Box of 1 by Merck", + "CONCEPT_ID" : 4073700, + "CONCEPT_NAME" : "Transurethral laser prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP496837", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "176288003", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44075484, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda] by Merck", + "CONCEPT_ID" : 4234536, + "CONCEPT_NAME" : "Transurethral prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1070115", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "90199006", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44081458, - "CONCEPT_NAME" : "pembrolizumab Injectable Suspension", + "CONCEPT_ID" : 4287859, + "CONCEPT_NAME" : "Transurethral resection of prostate, first stage of two stages", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1076089", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "68986004", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44082527, - "CONCEPT_NAME" : "pembrolizumab Injectable Suspension [Keytruda]", + "CONCEPT_ID" : 44783043, + "CONCEPT_NAME" : "Transurethral thulium laser enucleation of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1077158", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Form" + "CONCEPT_CODE" : "699077003", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44084103, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension", + "CONCEPT_ID" : 4071791, + "CONCEPT_NAME" : "Transvesical two stage prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1078734", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "176260009", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44124784, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injectable Suspension [Keytruda]", + "CONCEPT_ID" : 4054558, + "CONCEPT_NAME" : "Two stage subtotal suprapubic prostatectomy", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP1119415", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "21190008", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, - "isExcluded" : false, + "isExcluded" : true, "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 44164861, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injectable Solution Box of 1", + "CONCEPT_ID" : 4330932, + "CONCEPT_NAME" : "CT of prostate for radiotherapy planning", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3041584", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Box" + "CONCEPT_CODE" : "429856001", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -3815,16 +4314,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44164862, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injectable Solution", + "CONCEPT_ID" : 37396025, + "CONCEPT_NAME" : "CT of prostate with contrast for radiotherapy planning", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3041585", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "715687002", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -3832,16 +4331,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44175744, - "CONCEPT_NAME" : "pembrolizumab Injectable Solution", + "CONCEPT_ID" : 2108724, + "CONCEPT_NAME" : "External beam radiotherapy as primary therapy to prostate with or without nodal irradiation (PRCA)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3052467", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "4200F", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" }, "isExcluded" : false, "includeDescendants" : true, @@ -3849,16 +4348,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44184353, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection [Keytruda] Box of 1", + "CONCEPT_ID" : 2108725, + "CONCEPT_NAME" : "External beam radiotherapy with or without nodal irradiation as adjuvant or salvage therapy for prostate cancer patient (PRCA)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3061076", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Branded Drug Box" + "CONCEPT_CODE" : "4201F", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" }, "isExcluded" : false, "includeDescendants" : true, @@ -3866,16 +4365,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44191541, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda] Box of 1", + "CONCEPT_ID" : 4198015, + "CONCEPT_NAME" : "MRI of prostate for radiotherapy planning", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3068264", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Branded Box" + "CONCEPT_CODE" : "431850000", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -3883,16 +4382,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44191562, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution", + "CONCEPT_ID" : 43533205, + "CONCEPT_NAME" : "Low dose rate (ldr) prostate brachytherapy services, composite rate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3068285", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Clinical Drug" + "CONCEPT_CODE" : "G0458", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "HCPCS", + "CONCEPT_CLASS_ID" : "HCPCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -3900,16 +4399,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44191588, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injectable Solution Box of 1", + "CONCEPT_ID" : 2790073, + "CONCEPT_NAME" : "Contact Radiation of Prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3068311", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Quant Clinical Box" + "CONCEPT_CODE" : "DVY07ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -3917,16 +4416,16 @@ }, { "concept" : { - "CONCEPT_ID" : 44191599, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda] Box of 1 by Merck", + "CONCEPT_ID" : 1781260, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Cesium 131 (Cs-131)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP3068322", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Marketed Product" + "CONCEPT_CODE" : "DV10B6Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -3934,16 +4433,16 @@ }, { "concept" : { - "CONCEPT_ID" : 45775965, - "CONCEPT_NAME" : "pembrolizumab", + "CONCEPT_ID" : 4041984, + "CONCEPT_NAME" : "Laser ablation of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1547545", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CODE" : "118164001", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -3951,16 +4450,16 @@ }, { "concept" : { - "CONCEPT_ID" : 45775966, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML", + "CONCEPT_ID" : 2789856, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Other Isotope", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1547546", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug Comp" + "CONCEPT_CODE" : "DV10BYZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -3968,16 +4467,16 @@ }, { "concept" : { - "CONCEPT_ID" : 45775970, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML [Keytruda]", + "CONCEPT_ID" : 1524039, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Palladium 103 (Pd-103), Unidirectional Source", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1547551", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug Comp" + "CONCEPT_CODE" : "DV10BB1", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -3985,16 +4484,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276407, - "CONCEPT_NAME" : "pembrolizumab 50 MG", + "CONCEPT_ID" : 37111533, + "CONCEPT_NAME" : "Ultrasonography guided transrectal cryoablation of prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657744", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug Comp" + "CONCEPT_CODE" : "726544002", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -4002,16 +4501,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276408, - "CONCEPT_NAME" : "pembrolizumab Injection", + "CONCEPT_ID" : 4061656, + "CONCEPT_NAME" : "Microwave therapy to prostate", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657745", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "169429005", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" }, "isExcluded" : false, "includeDescendants" : true, @@ -4019,16 +4518,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276409, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection", + "CONCEPT_ID" : 2789850, + "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Other Isotope", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657746", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "DV109YZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4036,16 +4535,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276410, - "CONCEPT_NAME" : "pembrolizumab 50 MG [Keytruda]", + "CONCEPT_ID" : 2789851, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Cesium 137 (Cs-137)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657747", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug Comp" + "CONCEPT_CODE" : "DV10B7Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4053,16 +4552,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276411, - "CONCEPT_NAME" : "pembrolizumab Injection [Keytruda]", + "CONCEPT_ID" : 2789848, + "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Palladium 103 (Pd-103)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657748", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug Form" + "CONCEPT_CODE" : "DV109BZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4070,16 +4569,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276412, - "CONCEPT_NAME" : "pembrolizumab 50 MG Injection [Keytruda]", + "CONCEPT_ID" : 2789849, + "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Californium 252 (Cf-252)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657749", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "DV109CZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4087,16 +4586,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276413, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection", + "CONCEPT_ID" : 2789854, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Palladium 103 (Pd-103)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657750", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Quant Clinical Drug" + "CONCEPT_CODE" : "DV10BBZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4104,16 +4603,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276414, - "CONCEPT_NAME" : "4 ML pembrolizumab 25 MG/ML Injection [Keytruda]", + "CONCEPT_ID" : 2789855, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Californium 252 (Cf-252)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657751", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Quant Branded Drug" + "CONCEPT_CODE" : "DV10BCZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4121,16 +4620,16 @@ }, { "concept" : { - "CONCEPT_ID" : 46276415, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection", + "CONCEPT_ID" : 2789852, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Iridium 192 (Ir-192)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657752", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Clinical Drug" + "CONCEPT_CODE" : "DV10B8Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4138,41 +4637,33 @@ }, { "concept" : { - "CONCEPT_ID" : 46276416, - "CONCEPT_NAME" : "pembrolizumab 25 MG/ML Injection [Keytruda]", + "CONCEPT_ID" : 2789853, + "CONCEPT_NAME" : "Low Dose Rate (LDR) Brachytherapy of Prostate using Iodine 125 (I-125)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1657753", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Branded Drug" + "CONCEPT_CODE" : "DV10B9Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - }, - { - "id" : 19, - "name" : "[PIONEER V2.0] Radium-223", - "expression" : { - "items" : [ + }, { "concept" : { - "CONCEPT_ID" : 45775578, - "CONCEPT_NAME" : "radium", + "CONCEPT_ID" : 2789846, + "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Iridium 192 (Ir-192)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1546450", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CODE" : "DV1098Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4180,16 +4671,16 @@ }, { "concept" : { - "CONCEPT_ID" : 902727, - "CONCEPT_NAME" : "Radium-223", + "CONCEPT_ID" : 2789847, + "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Iodine 125 (I-125)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP5042947", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CODE" : "DV1099Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, "isExcluded" : false, "includeDescendants" : true, @@ -4197,48 +4688,286 @@ }, { "concept" : { - "CONCEPT_ID" : 41267222, - "CONCEPT_NAME" : "Radium Oral Solution", + "CONCEPT_ID" : 2789845, + "CONCEPT_NAME" : "High Dose Rate (HDR) Brachytherapy of Prostate using Cesium 137 (Cs-137)", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "OMOP2465184", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm Extension", - "CONCEPT_CLASS_ID" : "Clinical Drug Form" + "CONCEPT_CODE" : "DV1097Z", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" }, - "isExcluded" : true, - "includeDescendants" : false, + "isExcluded" : false, + "includeDescendants" : true, "includeMapped" : false }, { "concept" : { - "CONCEPT_ID" : 43526934, - "CONCEPT_NAME" : "radium chloride Ra-223", + "CONCEPT_ID" : 759648, + "CONCEPT_NAME" : "Ablation of malignant prostate tissue, transrectal, with high intensity-focused ultrasound (HIFU), including ultrasound guidance", "STANDARD_CONCEPT" : "S", "STANDARD_CONCEPT_CAPTION" : "Standard", "INVALID_REASON" : "V", "INVALID_REASON_CAPTION" : "Valid", - "CONCEPT_CODE" : "1424174", - "DOMAIN_ID" : "Drug", - "VOCABULARY_ID" : "RxNorm", - "CONCEPT_CLASS_ID" : "Ingredient" + "CONCEPT_CODE" : "55880", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" }, "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false - } - ] - } - } - ], - "QualifiedLimit" : { - "Type" : "First" - }, - "ExpressionLimit" : { + }, + { + "concept" : { + "CONCEPT_ID" : 4073126, + "CONCEPT_NAME" : "Cryotherapy to prostate via perineal probe", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176319004", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2110047, + "CONCEPT_NAME" : "Transperineal placement of needles or catheters into prostate for interstitial radioelement application, with or without cystoscopy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "55875", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 37111533, + "CONCEPT_NAME" : "Ultrasonography guided transrectal cryoablation of prostate", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "726544002", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2110046, + "CONCEPT_NAME" : "Cryosurgical ablation of the prostate (includes ultrasonic guidance and monitoring)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "55873", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2110035, + "CONCEPT_NAME" : "Prostatectomy (including control of postoperative bleeding, vasectomy, meatotomy, urethral calibration and/or dilation, and internal urethrotomy); suprapubic, subtotal, 1 or 2 stages", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "55821", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2108678, + "CONCEPT_NAME" : "Adjuvant (ie, in combination with external beam radiotherapy to the prostate for prostate cancer) hormonal therapy (gonadotropin-releasing hormone [GnRH] agonist or antagonist) prescribed/administered (PRCA)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "4164F", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : true, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2101059, + "CONCEPT_NAME" : "Anesthesia for; perineal prostatectomy", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "00908", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2777698, + "CONCEPT_NAME" : "Excision of Prostate, Open Approach", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "0VB00ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 40490346, + "CONCEPT_NAME" : "Transrectal high intensity focused ultrasound ablation of prostate", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "446941000", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2110043, + "CONCEPT_NAME" : "Exposure of prostate, any approach, for insertion of radioactive substance; with bilateral pelvic lymphadenectomy, including external iliac, hypogastric and obturator nodes", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "55865", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2789830, + "CONCEPT_NAME" : "Beam Radiation of Prostate using Photons >10 MeV", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "DV002ZZ", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "ICD10PCS", + "CONCEPT_CLASS_ID" : "ICD10PCS" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 709928, + "CONCEPT_NAME" : "Transurethral ablation of malignant prostate tissue by high-energy water vapor thermotherapy, including intraoperative imaging and needle guidance", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "0582T", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 42733763, + "CONCEPT_NAME" : "Transurethral resection of prostate; first stage of two-stage resection (partial resection) (Deprecated)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "52612", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 42733764, + "CONCEPT_NAME" : "Transurethral resection of prostate; second stage of two-stage resection (resection completed) (Deprecated)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "52614", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + } + ] + } + } + ], + "QualifiedLimit" : { "Type" : "First" }, + "ExpressionLimit" : { + "Type" : "All" + }, "InclusionRules" : [ { "name" : "Male", @@ -4283,320 +5012,300 @@ } }, { - "name" : "metastasis", + "name" : "no other drugs", "expression" : { "Type" : "ALL", - "CriteriaList" : [], - "DemographicCriteriaList" : [], - "Groups" : [ + "CriteriaList" : [ { - "Type" : "ANY", - "CriteriaList" : [ - { - "Criteria" : { - "ConditionOccurrence" : { - "CorrelatedCriteria" : { - "Type" : "ALL", - "CriteriaList" : [], - "DemographicCriteriaList" : [], - "Groups" : [ - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "ConditionOccurrence" : { - "CodesetId" : 2, - "ConditionTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 30, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "ProcedureOccurrence" : { - "CodesetId" : 4, - "ProcedureTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 1, - "Coeff" : -1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 183, - "Coeff" : -1 - }, - "End" : { - "Days" : 1, - "Coeff" : -1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - }, + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 14, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 15, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 16, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 17, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Days" : 0, + "Coeff" : -1 + }, + "End" : { + "Days" : 183, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + }, + { + "name" : "No other primary", + "expression" : { + "Type" : "ALL", + "CriteriaList" : [ + { + "Criteria" : { + "ConditionOccurrence" : { + "CodesetId" : 10, + "ConditionTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "Observation" : { + "CodesetId" : 10, + "ObservationTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [] + } + }, + { + "name" : "metastasis", + "expression" : { + "Type" : "ANY", + "CriteriaList" : [], + "DemographicCriteriaList" : [], + "Groups" : [ + { + "Type" : "AT_LEAST", + "Count" : 1, + "CriteriaList" : [ + { + "Criteria" : { + "ConditionOccurrence" : { + "CorrelatedCriteria" : { + "Type" : "ALL", + "CriteriaList" : [ { - "Type" : "ANY", - "CriteriaList" : [ - { - "Criteria" : { - "ProcedureOccurrence" : { - "CodesetId" : 11, - "ProcedureTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 184, - "Coeff" : -1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "Observation" : { - "CodesetId" : 11, - "ObservationTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 184, - "Coeff" : -1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } + "Criteria" : { + "ConditionOccurrence" : { + "CodesetId" : 2, + "ConditionTypeExclude" : false } - ], - "DemographicCriteriaList" : [], - "Groups" : [] + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 + }, + "End" : { + "Days" : 30, + "Coeff" : 1 + }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 2, + "Count" : 1, + "IsDistinct" : false + } }, { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } + "Criteria" : { + "DrugExposure" : { + "CodesetId" : 11, + "DrugTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } + "End" : { + "Days" : 1, + "Coeff" : -1 }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + }, + { + "Criteria" : { + "ProcedureOccurrence" : { + "CodesetId" : 4, + "ProcedureTypeExclude" : false + } + }, + "StartWindow" : { + "Start" : { + "Coeff" : -1 }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 18, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } + "End" : { + "Days" : 1, + "Coeff" : -1 }, + "UseIndexEnd" : false, + "UseEventEnd" : false + }, + "RestrictVisit" : false, + "IgnoreObservationPeriod" : false, + "Occurrence" : { + "Type" : 0, + "Count" : 0, + "IsDistinct" : false + } + } + ], + "DemographicCriteriaList" : [], + "Groups" : [ + { + "Type" : "ANY", + "CriteriaList" : [ { "Criteria" : { - "DrugExposure" : { + "Observation" : { "CodesetId" : 19, - "DrugTypeExclude" : false + "ObservationTypeExclude" : false } }, "StartWindow" : { "Start" : { - "Days" : 0, "Coeff" : -1 }, "End" : { - "Days" : 183, - "Coeff" : 1 + "Days" : 184, + "Coeff" : -1 }, "UseIndexEnd" : false, "UseEventEnd" : false @@ -4604,26 +5313,25 @@ "RestrictVisit" : false, "IgnoreObservationPeriod" : false, "Occurrence" : { - "Type" : 0, - "Count" : 0, + "Type" : 2, + "Count" : 1, "IsDistinct" : false } }, { "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false + "ProcedureOccurrence" : { + "CodesetId" : 19, + "ProcedureTypeExclude" : false } }, "StartWindow" : { "Start" : { - "Days" : 0, "Coeff" : -1 }, "End" : { - "Days" : 183, - "Coeff" : 1 + "Days" : 184, + "Coeff" : -1 }, "UseIndexEnd" : false, "UseEventEnd" : false @@ -4682,7 +5390,6 @@ }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -4702,9 +5409,9 @@ }, { "Criteria" : { - "ProcedureOccurrence" : { - "CodesetId" : 4, - "ProcedureTypeExclude" : false + "DrugExposure" : { + "CodesetId" : 11, + "DrugTypeExclude" : false } }, "StartWindow" : { @@ -4728,14 +5435,13 @@ }, { "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false + "ProcedureOccurrence" : { + "CodesetId" : 4, + "ProcedureTypeExclude" : false } }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -4762,7 +5468,7 @@ { "Criteria" : { "Observation" : { - "CodesetId" : 11, + "CodesetId" : 19, "ObservationTypeExclude" : false } }, @@ -4788,7 +5494,7 @@ { "Criteria" : { "ProcedureOccurrence" : { - "CodesetId" : 11, + "CodesetId" : 19, "ProcedureTypeExclude" : false } }, @@ -4814,208 +5520,62 @@ ], "DemographicCriteriaList" : [], "Groups" : [] - }, - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 18, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 19, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] } ] }, - "CodesetId" : 6, + "CodesetId" : 7, "First" : true, - "MeasurementTypeExclude" : false + "MeasurementTypeExclude" : false, + "ValueAsConcept" : [ + { + "CONCEPT_ID" : 45878386, + "CONCEPT_NAME" : "M1C", + "STANDARD_CONCEPT" : null, + "STANDARD_CONCEPT_CAPTION" : "Unknown", + "INVALID_REASON" : null, + "INVALID_REASON_CAPTION" : "Unknown", + "CONCEPT_CODE" : "LA4625-5", + "DOMAIN_ID" : "Meas Value", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : null + }, + { + "CONCEPT_ID" : 45881618, + "CONCEPT_NAME" : "M1B", + "STANDARD_CONCEPT" : null, + "STANDARD_CONCEPT_CAPTION" : "Unknown", + "INVALID_REASON" : null, + "INVALID_REASON_CAPTION" : "Unknown", + "CONCEPT_CODE" : "LA4626-3", + "DOMAIN_ID" : "Meas Value", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : null + }, + { + "CONCEPT_ID" : 45882500, + "CONCEPT_NAME" : "M1A", + "STANDARD_CONCEPT" : null, + "STANDARD_CONCEPT_CAPTION" : "Unknown", + "INVALID_REASON" : null, + "INVALID_REASON_CAPTION" : "Unknown", + "CONCEPT_CODE" : "LA4627-1", + "DOMAIN_ID" : "Meas Value", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : null + }, + { + "CONCEPT_ID" : 45876322, + "CONCEPT_NAME" : "M1", + "STANDARD_CONCEPT" : null, + "STANDARD_CONCEPT_CAPTION" : "Unknown", + "INVALID_REASON" : null, + "INVALID_REASON_CAPTION" : "Unknown", + "CONCEPT_CODE" : "LA4628-9", + "DOMAIN_ID" : "Meas Value", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : null + } + ] } }, "StartWindow" : { @@ -5053,7 +5613,6 @@ }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -5073,9 +5632,9 @@ }, { "Criteria" : { - "ProcedureOccurrence" : { - "CodesetId" : 4, - "ProcedureTypeExclude" : false + "DrugExposure" : { + "CodesetId" : 11, + "DrugTypeExclude" : false } }, "StartWindow" : { @@ -5099,14 +5658,13 @@ }, { "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false + "ProcedureOccurrence" : { + "CodesetId" : 4, + "ProcedureTypeExclude" : false } }, "StartWindow" : { "Start" : { - "Days" : 183, "Coeff" : -1 }, "End" : { @@ -5130,36 +5688,10 @@ { "Type" : "ANY", "CriteriaList" : [ - { - "Criteria" : { - "ProcedureOccurrence" : { - "CodesetId" : 11, - "ProcedureTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 184, - "Coeff" : -1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, { "Criteria" : { "Observation" : { - "CodesetId" : 11, + "CodesetId" : 19, "ObservationTypeExclude" : false } }, @@ -5181,192 +5713,22 @@ "Count" : 1, "IsDistinct" : false } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - }, - { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 14, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 15, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 2, - "Count" : 1, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 18, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 16, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 17, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, - "Coeff" : -1 - }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } }, { "Criteria" : { - "DrugExposure" : { + "ProcedureOccurrence" : { "CodesetId" : 19, - "DrugTypeExclude" : false + "ProcedureTypeExclude" : false } }, "StartWindow" : { "Start" : { - "Days" : 0, "Coeff" : -1 }, "End" : { - "Days" : 183, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - }, - { - "Criteria" : { - "DrugExposure" : { - "CodesetId" : 13, - "DrugTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Days" : 0, + "Days" : 184, "Coeff" : -1 }, - "End" : { - "Days" : 183, - "Coeff" : 1 - }, "UseIndexEnd" : false, "UseEventEnd" : false }, @@ -5384,59 +5746,9 @@ } ] }, - "CodesetId" : 9, + "CodesetId" : 6, "First" : true, - "MeasurementTypeExclude" : false, - "ValueAsConcept" : [ - { - "CONCEPT_ID" : 45878386, - "CONCEPT_NAME" : "M1C", - "STANDARD_CONCEPT" : null, - "STANDARD_CONCEPT_CAPTION" : "Unknown", - "INVALID_REASON" : null, - "INVALID_REASON_CAPTION" : "Unknown", - "CONCEPT_CODE" : "LA4625-5", - "DOMAIN_ID" : "Meas Value", - "VOCABULARY_ID" : "LOINC", - "CONCEPT_CLASS_ID" : null - }, - { - "CONCEPT_ID" : 45881618, - "CONCEPT_NAME" : "M1B", - "STANDARD_CONCEPT" : null, - "STANDARD_CONCEPT_CAPTION" : "Unknown", - "INVALID_REASON" : null, - "INVALID_REASON_CAPTION" : "Unknown", - "CONCEPT_CODE" : "LA4626-3", - "DOMAIN_ID" : "Meas Value", - "VOCABULARY_ID" : "LOINC", - "CONCEPT_CLASS_ID" : null - }, - { - "CONCEPT_ID" : 45882500, - "CONCEPT_NAME" : "M1A", - "STANDARD_CONCEPT" : null, - "STANDARD_CONCEPT_CAPTION" : "Unknown", - "INVALID_REASON" : null, - "INVALID_REASON_CAPTION" : "Unknown", - "CONCEPT_CODE" : "LA4627-1", - "DOMAIN_ID" : "Meas Value", - "VOCABULARY_ID" : "LOINC", - "CONCEPT_CLASS_ID" : null - }, - { - "CONCEPT_ID" : 45876322, - "CONCEPT_NAME" : "M1", - "STANDARD_CONCEPT" : null, - "STANDARD_CONCEPT_CAPTION" : "Unknown", - "INVALID_REASON" : null, - "INVALID_REASON_CAPTION" : "Unknown", - "CONCEPT_CODE" : "LA4628-9", - "DOMAIN_ID" : "Meas Value", - "VOCABULARY_ID" : "LOINC", - "CONCEPT_CLASS_ID" : null - } - ] + "MeasurementTypeExclude" : false } }, "StartWindow" : { @@ -5465,48 +5777,12 @@ } ] } - }, - { - "name" : "no other primary", - "expression" : { - "Type" : "ALL", - "CriteriaList" : [ - { - "Criteria" : { - "ConditionOccurrence" : { - "CodesetId" : 12, - "ConditionTypeExclude" : false - } - }, - "StartWindow" : { - "Start" : { - "Coeff" : -1 - }, - "End" : { - "Days" : 30, - "Coeff" : 1 - }, - "UseIndexEnd" : false, - "UseEventEnd" : false - }, - "RestrictVisit" : false, - "IgnoreObservationPeriod" : false, - "Occurrence" : { - "Type" : 0, - "Count" : 0, - "IsDistinct" : false - } - } - ], - "DemographicCriteriaList" : [], - "Groups" : [] - } } ], "CensoringCriteria" : [ { "ConditionOccurrence" : { - "CodesetId" : 12, + "CodesetId" : 10, "ConditionTypeExclude" : false } } diff --git a/inst/cohorts/218.json b/inst/cohorts/218.json index 2702fa8..b7d7260 100644 --- a/inst/cohorts/218.json +++ b/inst/cohorts/218.json @@ -355,6 +355,40 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4023102, + "CONCEPT_NAME" : "Cystoscopic insertion of ureteric stent", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176073004", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 4022963, + "CONCEPT_NAME" : "Percutaneous insertion of ureteric stent", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "176053009", + "DOMAIN_ID" : "Procedure", + "VOCABULARY_ID" : "SNOMED", + "CONCEPT_CLASS_ID" : "Procedure" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false } ] } diff --git a/inst/cohorts/320.json b/inst/cohorts/320.json index b166029..ecedbd5 100644 --- a/inst/cohorts/320.json +++ b/inst/cohorts/320.json @@ -39,6 +39,23 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2106845, + "CONCEPT_NAME" : "Bone scan performed prior to initiation of treatment or at any time since diagnosis of prostate cancer (PRCA)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "3269F", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false } ] } diff --git a/inst/cohorts/335.json b/inst/cohorts/335.json index b166029..ecedbd5 100644 --- a/inst/cohorts/335.json +++ b/inst/cohorts/335.json @@ -39,6 +39,23 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 2106845, + "CONCEPT_NAME" : "Bone scan performed prior to initiation of treatment or at any time since diagnosis of prostate cancer (PRCA)", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "3269F", + "DOMAIN_ID" : "Observation", + "VOCABULARY_ID" : "CPT4", + "CONCEPT_CLASS_ID" : "CPT4" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false } ] } diff --git a/inst/cohorts/336.json b/inst/cohorts/336.json index 1fe7ba5..f587837 100644 --- a/inst/cohorts/336.json +++ b/inst/cohorts/336.json @@ -319,6 +319,227 @@ "isExcluded" : false, "includeDescendants" : true, "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 3027941, + "CONCEPT_NAME" : "CT Chest", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "24627-2", + "DOMAIN_ID" : "Measurement", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : "Clinical Observation" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 36305710, + "CONCEPT_NAME" : "CT Chest and Abdomen and Pelvis", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "87869-4", + "DOMAIN_ID" : "Measurement", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : "Clinical Observation" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 43055219, + "CONCEPT_NAME" : "CT Chest and Abdomen and Pelvis W contrast IV", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "72254-6", + "DOMAIN_ID" : "Measurement", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : "Clinical Observation" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 43055217, + "CONCEPT_NAME" : "CT Chest and Abdomen and Pelvis WO and W contrast IV", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "72252-0", + "DOMAIN_ID" : "Measurement", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : "Clinical Observation" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 43055218, + "CONCEPT_NAME" : "CT Chest and Abdomen and Pelvis WO contrast", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "72253-8", + "DOMAIN_ID" : "Measurement", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : "Clinical Observation" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 3035261, + "CONCEPT_NAME" : "CT Chest and Abdomen W contrast IV", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "42275-8", + "DOMAIN_ID" : "Measurement", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : "Clinical Observation" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 3029076, + "CONCEPT_NAME" : "CT Chest and Abdomen WO contrast", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "42276-6", + "DOMAIN_ID" : "Measurement", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : "Clinical Observation" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 36305511, + "CONCEPT_NAME" : "CT Chest for screening", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "87279-6", + "DOMAIN_ID" : "Measurement", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : "Clinical Observation" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 3049252, + "CONCEPT_NAME" : "CT Chest limited", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "36089-1", + "DOMAIN_ID" : "Measurement", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : "Clinical Observation" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 3013610, + "CONCEPT_NAME" : "CT Chest W contrast IV", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "24628-0", + "DOMAIN_ID" : "Measurement", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : "Clinical Observation" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 36303622, + "CONCEPT_NAME" : "CT Chest W contrast IV and CT angiogram Pulmonary arteries for pulmonary embolus W contrast IV", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "88322-3", + "DOMAIN_ID" : "Measurement", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : "Clinical Observation" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 3019825, + "CONCEPT_NAME" : "CT Chest WO and W contrast IV", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "30598-7", + "DOMAIN_ID" : "Measurement", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : "Clinical Observation" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false + }, + { + "concept" : { + "CONCEPT_ID" : 3018999, + "CONCEPT_NAME" : "CT Chest WO contrast", + "STANDARD_CONCEPT" : "S", + "STANDARD_CONCEPT_CAPTION" : "Standard", + "INVALID_REASON" : "V", + "INVALID_REASON_CAPTION" : "Valid", + "CONCEPT_CODE" : "29252-4", + "DOMAIN_ID" : "Measurement", + "VOCABULARY_ID" : "LOINC", + "CONCEPT_CLASS_ID" : "Clinical Observation" + }, + "isExcluded" : false, + "includeDescendants" : false, + "includeMapped" : false } ] } diff --git a/inst/sql/sql_server/101.sql b/inst/sql/sql_server/101.sql index 4956b6a..21c1e4c 100644 --- a/inst/sql/sql_server/101.sql +++ b/inst/sql/sql_server/101.sql @@ -7,7 +7,7 @@ CREATE TABLE #Codesets ( INSERT INTO #Codesets (codeset_id, concept_id) SELECT 1 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930,4264861,4264288,4246703,763131) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id @@ -40,11 +40,11 @@ WHERE E.concept_id is null ) C UNION ALL SELECT 3 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392,4312326) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (443392) + and ca.ancestor_concept_id in (443392,4312326) and c.invalid_reason is null ) I @@ -95,11 +95,11 @@ UNION select c.concept_id ) C UNION ALL SELECT 8 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533,2110046,2110035,2108678,2101059,2777698,40490346,2110043,2789830,709928,42733763,42733764) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533) + and ca.ancestor_concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533,2110046,2110035,2108678) and c.invalid_reason is null ) I @@ -402,6 +402,32 @@ FROM -- End Condition Occurrence Criteria +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria + +UNION ALL +-- Begin Correlated Criteria +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date +from +( + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 3) +) C + + +-- End Observation Criteria + ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 @@ -409,7 +435,7 @@ HAVING COUNT(cc.event_id) = 0 ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) = 2 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id diff --git a/inst/sql/sql_server/102.sql b/inst/sql/sql_server/102.sql index 333fc68..b595342 100644 --- a/inst/sql/sql_server/102.sql +++ b/inst/sql/sql_server/102.sql @@ -7,7 +7,7 @@ CREATE TABLE #Codesets ( INSERT INTO #Codesets (codeset_id, concept_id) SELECT 1 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930,4264861,4264288,4246703,763131) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id @@ -62,11 +62,11 @@ UNION select c.concept_id ) C UNION ALL SELECT 11 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392,4312326) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (443392) + and ca.ancestor_concept_id in (443392,4312326) and c.invalid_reason is null ) I @@ -486,6 +486,32 @@ FROM -- End Condition Occurrence Criteria +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria + +UNION ALL +-- Begin Correlated Criteria +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date +from +( + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 11) +) C + + +-- End Observation Criteria + ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 @@ -493,7 +519,7 @@ HAVING COUNT(cc.event_id) = 0 ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) = 2 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id diff --git a/inst/sql/sql_server/103.sql b/inst/sql/sql_server/103.sql index 66d6494..d15df6a 100644 --- a/inst/sql/sql_server/103.sql +++ b/inst/sql/sql_server/103.sql @@ -7,7 +7,7 @@ CREATE TABLE #Codesets ( INSERT INTO #Codesets (codeset_id, concept_id) SELECT 1 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930,4264861,4264288,4246703,763131) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id @@ -84,11 +84,11 @@ UNION select c.concept_id ) C UNION ALL SELECT 10 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392,4312326) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (443392) + and ca.ancestor_concept_id in (443392,4312326) and c.invalid_reason is null ) I @@ -106,11 +106,11 @@ WHERE E.concept_id is null ) C UNION ALL SELECT 12 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533,2110046,2110035,2108678,2101059,2777698,40490346,2110043,2789830,709928,42733763,42733764) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533) + and ca.ancestor_concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533,2110046,2110035,2108678) and c.invalid_reason is null ) I @@ -439,6 +439,32 @@ FROM -- End Condition Occurrence Criteria +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria + +UNION ALL +-- Begin Correlated Criteria +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date +from +( + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 10) +) C + + +-- End Observation Criteria + ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 @@ -446,7 +472,7 @@ HAVING COUNT(cc.event_id) = 0 ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) = 2 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id diff --git a/inst/sql/sql_server/104.sql b/inst/sql/sql_server/104.sql index 0688fc7..87757a3 100644 --- a/inst/sql/sql_server/104.sql +++ b/inst/sql/sql_server/104.sql @@ -7,7 +7,7 @@ CREATE TABLE #Codesets ( INSERT INTO #Codesets (codeset_id, concept_id) SELECT 1 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930,4264861,4264288,4246703,763131) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id @@ -79,11 +79,11 @@ UNION select c.concept_id ) C UNION ALL SELECT 10 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392,4312326) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (443392) + and ca.ancestor_concept_id in (443392,4312326) and c.invalid_reason is null ) I @@ -606,6 +606,32 @@ FROM -- End Condition Occurrence Criteria +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria + +UNION ALL +-- Begin Correlated Criteria +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date +from +( + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 10) +) C + + +-- End Observation Criteria + ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 @@ -613,7 +639,7 @@ HAVING COUNT(cc.event_id) = 0 ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) = 2 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id diff --git a/inst/sql/sql_server/105.sql b/inst/sql/sql_server/105.sql index a3def35..e55d3d5 100644 --- a/inst/sql/sql_server/105.sql +++ b/inst/sql/sql_server/105.sql @@ -7,7 +7,7 @@ CREATE TABLE #Codesets ( INSERT INTO #Codesets (codeset_id, concept_id) SELECT 1 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930,4264861,4264288,4246703,763131) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id @@ -95,11 +95,11 @@ UNION select c.concept_id ) C UNION ALL SELECT 10 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392,4312326) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (443392) + and ca.ancestor_concept_id in (443392,4312326) and c.invalid_reason is null ) I @@ -1000,6 +1000,32 @@ FROM -- End Condition Occurrence Criteria +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria + +UNION ALL +-- Begin Correlated Criteria +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date +from +( + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 10) +) C + + +-- End Observation Criteria + ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 @@ -1007,7 +1033,7 @@ HAVING COUNT(cc.event_id) = 0 ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) = 2 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id diff --git a/inst/sql/sql_server/106.sql b/inst/sql/sql_server/106.sql index 6f54331..d9326a9 100644 --- a/inst/sql/sql_server/106.sql +++ b/inst/sql/sql_server/106.sql @@ -7,7 +7,7 @@ CREATE TABLE #Codesets ( INSERT INTO #Codesets (codeset_id, concept_id) SELECT 1 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930,4264861,4264288,4246703,763131) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id @@ -95,11 +95,11 @@ UNION select c.concept_id ) C UNION ALL SELECT 11 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533,2110046,2110035,2108678,2101059,2777698,40490346,2110043,2789830,709928,42733763,42733764) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533) + and ca.ancestor_concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533,2110046,2110035,2108678) and c.invalid_reason is null ) I @@ -117,11 +117,11 @@ WHERE E.concept_id is null ) C UNION ALL SELECT 12 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392,4312326) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (443392) + and ca.ancestor_concept_id in (443392,4312326) and c.invalid_reason is null ) I @@ -1457,6 +1457,32 @@ FROM -- End Condition Occurrence Criteria +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria + +UNION ALL +-- Begin Correlated Criteria +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date +from +( + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 12) +) C + + +-- End Observation Criteria + ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 @@ -1464,7 +1490,7 @@ HAVING COUNT(cc.event_id) = 0 ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) = 2 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id diff --git a/inst/sql/sql_server/107.sql b/inst/sql/sql_server/107.sql index b30df05..00ab5eb 100644 --- a/inst/sql/sql_server/107.sql +++ b/inst/sql/sql_server/107.sql @@ -7,7 +7,7 @@ CREATE TABLE #Codesets ( INSERT INTO #Codesets (codeset_id, concept_id) SELECT 1 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930,4264861,4264288,4246703,763131) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id @@ -79,11 +79,11 @@ UNION select c.concept_id ) C UNION ALL SELECT 10 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392,4312326) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (443392) + and ca.ancestor_concept_id in (443392,4312326) and c.invalid_reason is null ) I @@ -321,166 +321,71 @@ JOIN ( -- Begin Criteria Group select 0 as index_id, person_id, event_id FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM ( select E.person_id, E.event_id FROM #qualified_events E INNER JOIN ( -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id +select 0 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id FROM #qualified_events P JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) PE -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C +-- End Drug Exposure Criteria -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +UNION ALL +-- Begin Correlated Criteria +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( - -- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) ) C --- End Condition Occurrence Criteria +-- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL --- Begin Criteria Group -select 1 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +-- Begin Correlated Criteria +select 2 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -490,7 +395,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) ) C @@ -503,43 +408,11 @@ HAVING COUNT(cc.event_id) = 0 UNION ALL -- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +select 3 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -549,7 +422,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) ) C @@ -562,43 +435,11 @@ HAVING COUNT(cc.event_id) = 0 UNION ALL -- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +select 4 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -608,7 +449,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) ) C @@ -621,43 +462,11 @@ HAVING COUNT(cc.event_id) = 0 UNION ALL -- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +select 5 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -667,7 +476,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C @@ -675,206 +484,136 @@ JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +HAVING COUNT(cc.event_id) >= 0 -- End Correlated Criteria -UNION ALL --- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 6 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; + +select 3 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_3 FROM ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria +FROM #qualified_events P +JOIN ( + -- Begin Condition Occurrence Criteria SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, C.visit_occurrence_id, C.condition_start_date as sort_date FROM ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + SELECT co.* FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 10) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 10) ) C --- End Drug Exposure Criteria +-- End Observation Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria -UNION ALL --- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 -) G --- End Criteria Group - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id HAVING COUNT(index_id) = 2 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id +select 4 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_4 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM #qualified_events P JOIN ( select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria +WHERE C.ordinal = 1 +-- End Condition Occurrence Criteria ) PE JOIN ( @@ -884,620 +623,18 @@ FROM ( select E.person_id, E.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - - --- End Condition Occurrence Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Criteria Group -select 1 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 -) G --- End Criteria Group - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 2 -) G --- End Criteria Group -) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria - -) PE -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Condition Occurrence Criteria +FROM (-- Begin Condition Occurrence Criteria SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, C.visit_occurrence_id, C.condition_start_date as sort_date FROM ( - SELECT co.* + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - - --- End Condition Occurrence Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Criteria Group -select 1 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -1505,244 +642,85 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id INNER JOIN ( -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) >= 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +select 1 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Measurement Criteria +select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, + C.visit_occurrence_id, C.measurement_date as sort_date +from +( + select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal + FROM @cdm_database_schema.MEASUREMENT m +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) +) C + +WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) +AND C.ordinal = 1 +-- End Measurement Criteria + +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date @@ -1750,17 +728,21 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C -WHERE C.ordinal = 1 +WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) +AND C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, @@ -1769,40 +751,55 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C -WHERE C.ordinal = 1 +WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) +AND C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) >= 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria +select 2 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date from @@ -1814,13 +811,15 @@ JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id WHERE C.ordinal = 1 -- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date + +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date @@ -1836,30 +835,11 @@ WHERE C.ordinal = 1 ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria @@ -1879,34 +859,27 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 -) G --- End Criteria Group - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 2 + HAVING COUNT(index_id) >= 1 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id @@ -1918,63 +891,13 @@ HAVING COUNT(cc.event_id) >= 1 ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) > 0 -) G --- End Criteria Group - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) >= 1 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; - -select 3 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_3 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from #qualified_events p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - -- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 10) -) C - - --- End Condition Occurrence Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) > 0 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id @@ -1989,7 +912,9 @@ select inclusion_rule_id, person_id, event_id from #Inclusion_1 UNION ALL select inclusion_rule_id, person_id, event_id from #Inclusion_2 UNION ALL -select inclusion_rule_id, person_id, event_id from #Inclusion_3) I; +select inclusion_rule_id, person_id, event_id from #Inclusion_3 +UNION ALL +select inclusion_rule_id, person_id, event_id from #Inclusion_4) I; TRUNCATE TABLE #Inclusion_0; DROP TABLE #Inclusion_0; @@ -2002,6 +927,9 @@ DROP TABLE #Inclusion_2; TRUNCATE TABLE #Inclusion_3; DROP TABLE #Inclusion_3; +TRUNCATE TABLE #Inclusion_4; +DROP TABLE #Inclusion_4; + with cteIncludedEvents(event_id, person_id, start_date, end_date, op_start_date, op_end_date, ordinal) as ( @@ -2015,13 +943,13 @@ with cteIncludedEvents(event_id, person_id, start_date, end_date, op_start_date, ) MG -- matching groups -- the matching group with all bits set ( POWER(2,# of inclusion rules) - 1 = inclusion_rule_mask - WHERE (MG.inclusion_rule_mask = POWER(cast(2 as bigint),4)-1) + WHERE (MG.inclusion_rule_mask = POWER(cast(2 as bigint),5)-1) ) select event_id, person_id, start_date, end_date, op_start_date, op_end_date into #included_events FROM cteIncludedEvents Results -WHERE Results.ordinal = 1 + ; diff --git a/inst/sql/sql_server/108.sql b/inst/sql/sql_server/108.sql index 1db1492..7c394b9 100644 --- a/inst/sql/sql_server/108.sql +++ b/inst/sql/sql_server/108.sql @@ -7,7 +7,7 @@ CREATE TABLE #Codesets ( INSERT INTO #Codesets (codeset_id, concept_id) SELECT 1 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930,4264861,4264288,4246703,763131) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id @@ -79,11 +79,11 @@ UNION select c.concept_id ) C UNION ALL SELECT 10 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392,4312326) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (443392) + and ca.ancestor_concept_id in (443392,4312326) and c.invalid_reason is null ) I @@ -195,7 +195,8 @@ FROM OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date, cast(E.visit_occurrence_id as bigint) as visit_occurrence_id FROM ( - -- Begin Drug Exposure Criteria + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -209,22 +210,38 @@ JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria -UNION ALL --- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C -WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) --- End Procedure Occurrence Criteria - -UNION ALL --- Begin Drug Exposure Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -232,141 +249,56 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria - - ) E - JOIN @cdm_database_schema.observation_period OP on E.person_id = OP.person_id and E.start_date >= OP.observation_period_start_date and E.start_date <= op.observation_period_end_date - WHERE DATEADD(day,183,OP.OBSERVATION_PERIOD_START_DATE) <= E.START_DATE AND DATEADD(day,0,E.START_DATE) <= OP.OBSERVATION_PERIOD_END_DATE +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P -WHERE P.ordinal = 1 --- End Primary Events - -) -SELECT event_id, person_id, start_date, end_date, op_start_date, op_end_date, visit_occurrence_id -INTO #qualified_events -FROM -( - select pe.event_id, pe.person_id, pe.start_date, pe.end_date, pe.op_start_date, pe.op_end_date, row_number() over (partition by pe.person_id order by pe.start_date ASC) as ordinal, cast(pe.visit_occurrence_id as bigint) as visit_occurrence_id - FROM primary_events pe - -) QE - -; - ---- Inclusion Rule Inserts - -select 0 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_0 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Demographic Criteria -SELECT 0 as index_id, e.person_id, e.event_id -FROM #qualified_events E -JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID -WHERE P.gender_concept_id in (8507) -GROUP BY e.person_id, e.event_id --- End Demographic Criteria + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) +) C - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 -) G --- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; -select 1 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_1 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Demographic Criteria -SELECT 0 as index_id, e.person_id, e.event_id -FROM #qualified_events E -JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID -WHERE YEAR(E.start_date) - P.year_of_birth >= 18 -GROUP BY e.person_id, e.event_id --- End Demographic Criteria +-- End Drug Exposure Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) >= 1 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id -select 2 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_2 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +UNION ALL +select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria ) PE JOIN ( @@ -376,18 +308,18 @@ FROM ( select E.person_id, E.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -398,60 +330,86 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C --- End Condition Occurrence Criteria +-- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) >= 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + UNION ALL --- Begin Criteria Group -select 1 as index_id, person_id, event_id -FROM +select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) +) C + +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria + +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from +( + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -462,18 +420,19 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -487,7 +446,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C @@ -500,102 +459,161 @@ HAVING COUNT(cc.event_id) >= 1 UNION ALL -- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +select 1 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) > 0 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + + ) E + JOIN @cdm_database_schema.observation_period OP on E.person_id = OP.person_id and E.start_date >= OP.observation_period_start_date and E.start_date <= op.observation_period_end_date + WHERE DATEADD(day,183,OP.OBSERVATION_PERIOD_START_DATE) <= E.START_DATE AND DATEADD(day,0,E.START_DATE) <= OP.OBSERVATION_PERIOD_END_DATE +) P +WHERE P.ordinal = 1 +-- End Primary Events + +) +SELECT event_id, person_id, start_date, end_date, op_start_date, op_end_date, visit_occurrence_id +INTO #qualified_events FROM ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C + select pe.event_id, pe.person_id, pe.start_date, pe.end_date, pe.op_start_date, pe.op_end_date, row_number() over (partition by pe.person_id order by pe.start_date ASC) as ordinal, cast(pe.visit_occurrence_id as bigint) as visit_occurrence_id + FROM primary_events pe + +) QE -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date +; + +--- Inclusion Rule Inserts + +select 0 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_0 FROM ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Demographic Criteria +SELECT 0 as index_id, e.person_id, e.event_id +FROM #qualified_events E +JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID +WHERE P.gender_concept_id in (8507) +GROUP BY e.person_id, e.event_id +-- End Demographic Criteria -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; + +select 1 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_1 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Demographic Criteria +SELECT 0 as index_id, e.person_id, e.event_id +FROM #qualified_events E +JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID +WHERE YEAR(E.start_date) - P.year_of_birth >= 18 +GROUP BY e.person_id, e.event_id +-- End Demographic Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; + +select 2 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_2 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -605,7 +623,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C @@ -618,43 +636,11 @@ HAVING COUNT(cc.event_id) = 0 UNION ALL -- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -664,7 +650,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) ) C @@ -677,43 +663,11 @@ HAVING COUNT(cc.event_id) = 0 UNION ALL -- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +select 2 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -723,7 +677,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) ) C @@ -736,43 +690,11 @@ HAVING COUNT(cc.event_id) = 0 UNION ALL -- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +select 3 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -782,7 +704,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) ) C @@ -795,25 +717,11 @@ HAVING COUNT(cc.event_id) = 0 UNION ALL -- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +select 4 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -823,104 +731,48 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 -) G --- End Criteria Group - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 2 + HAVING COUNT(index_id) = 5 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +select 3 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_3 +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria - -) PE + select pe.person_id, pe.event_id + FROM #qualified_events pe + JOIN ( -- Begin Criteria Group select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E + FROM #qualified_events E INNER JOIN ( -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +select 0 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( -- Begin Condition Occurrence Criteria SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, @@ -929,553 +781,115 @@ FROM ( SELECT co.* FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 10) ) C -- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL --- Begin Criteria Group -select 1 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date +-- Begin Correlated Criteria +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date from ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 10) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C +-- End Observation Criteria -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria -UNION ALL --- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 -) G --- End Criteria Group - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id HAVING COUNT(index_id) = 2 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; -) PE +select 4 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_4 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + JOIN ( -- Begin Criteria Group select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from + FROM #qualified_events E + INNER JOIN + ( + -- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E + select E.person_id, E.event_id + FROM #qualified_events E INNER JOIN ( -- Begin Correlated Criteria select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( - -- Begin Condition Occurrence Criteria + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Condition Occurrence Criteria SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, C.visit_occurrence_id, C.condition_start_date as sort_date FROM ( - SELECT co.* + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C - +WHERE C.ordinal = 1 -- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL +) PE +JOIN ( -- Begin Criteria Group -select 1 as index_id, person_id, event_id +select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -1486,223 +900,82 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) >= 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +select 1 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Measurement Criteria +select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, + C.visit_occurrence_id, C.measurement_date as sort_date +from +( + select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal + FROM @cdm_database_schema.MEASUREMENT m +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) +) C + +WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) +AND C.ordinal = 1 +-- End Measurement Criteria + +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date @@ -1710,17 +983,21 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C -WHERE C.ordinal = 1 +WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) +AND C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, @@ -1729,40 +1006,55 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C -WHERE C.ordinal = 1 +WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) +AND C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) >= 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria +select 2 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date from @@ -1774,13 +1066,15 @@ JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id WHERE C.ordinal = 1 -- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date + +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date @@ -1796,30 +1090,11 @@ WHERE C.ordinal = 1 ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria @@ -1839,34 +1114,27 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 -) G --- End Criteria Group - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 2 + HAVING COUNT(index_id) >= 1 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id @@ -1878,63 +1146,13 @@ HAVING COUNT(cc.event_id) >= 1 ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) > 0 -) G --- End Criteria Group - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) >= 1 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; - -select 3 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_3 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from #qualified_events p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - -- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 10) -) C - - --- End Condition Occurrence Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) > 0 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id @@ -1949,7 +1167,9 @@ select inclusion_rule_id, person_id, event_id from #Inclusion_1 UNION ALL select inclusion_rule_id, person_id, event_id from #Inclusion_2 UNION ALL -select inclusion_rule_id, person_id, event_id from #Inclusion_3) I; +select inclusion_rule_id, person_id, event_id from #Inclusion_3 +UNION ALL +select inclusion_rule_id, person_id, event_id from #Inclusion_4) I; TRUNCATE TABLE #Inclusion_0; DROP TABLE #Inclusion_0; @@ -1962,6 +1182,9 @@ DROP TABLE #Inclusion_2; TRUNCATE TABLE #Inclusion_3; DROP TABLE #Inclusion_3; +TRUNCATE TABLE #Inclusion_4; +DROP TABLE #Inclusion_4; + with cteIncludedEvents(event_id, person_id, start_date, end_date, op_start_date, op_end_date, ordinal) as ( @@ -1975,13 +1198,13 @@ with cteIncludedEvents(event_id, person_id, start_date, end_date, op_start_date, ) MG -- matching groups -- the matching group with all bits set ( POWER(2,# of inclusion rules) - 1 = inclusion_rule_mask - WHERE (MG.inclusion_rule_mask = POWER(cast(2 as bigint),4)-1) + WHERE (MG.inclusion_rule_mask = POWER(cast(2 as bigint),5)-1) ) select event_id, person_id, start_date, end_date, op_start_date, op_end_date into #included_events FROM cteIncludedEvents Results -WHERE Results.ordinal = 1 + ; diff --git a/inst/sql/sql_server/109.sql b/inst/sql/sql_server/109.sql index b98d6b4..68a93c5 100644 --- a/inst/sql/sql_server/109.sql +++ b/inst/sql/sql_server/109.sql @@ -7,7 +7,7 @@ CREATE TABLE #Codesets ( INSERT INTO #Codesets (codeset_id, concept_id) SELECT 1 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930,4264861,4264288,4246703,763131) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id @@ -79,11 +79,11 @@ UNION select c.concept_id ) C UNION ALL SELECT 10 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392,4312326) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (443392) + and ca.ancestor_concept_id in (443392,4312326) and c.invalid_reason is null ) I @@ -195,7 +195,8 @@ FROM OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date, cast(E.visit_occurrence_id as bigint) as visit_occurrence_id FROM ( - -- Begin Drug Exposure Criteria + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -209,22 +210,38 @@ JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria -UNION ALL --- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C -WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) --- End Procedure Occurrence Criteria - -UNION ALL --- Begin Drug Exposure Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -232,141 +249,56 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria - - ) E - JOIN @cdm_database_schema.observation_period OP on E.person_id = OP.person_id and E.start_date >= OP.observation_period_start_date and E.start_date <= op.observation_period_end_date - WHERE DATEADD(day,183,OP.OBSERVATION_PERIOD_START_DATE) <= E.START_DATE AND DATEADD(day,0,E.START_DATE) <= OP.OBSERVATION_PERIOD_END_DATE +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P -WHERE P.ordinal = 1 --- End Primary Events - -) -SELECT event_id, person_id, start_date, end_date, op_start_date, op_end_date, visit_occurrence_id -INTO #qualified_events -FROM -( - select pe.event_id, pe.person_id, pe.start_date, pe.end_date, pe.op_start_date, pe.op_end_date, row_number() over (partition by pe.person_id order by pe.start_date ASC) as ordinal, cast(pe.visit_occurrence_id as bigint) as visit_occurrence_id - FROM primary_events pe - -) QE - -; - ---- Inclusion Rule Inserts - -select 0 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_0 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Demographic Criteria -SELECT 0 as index_id, e.person_id, e.event_id -FROM #qualified_events E -JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID -WHERE P.gender_concept_id in (8507) -GROUP BY e.person_id, e.event_id --- End Demographic Criteria + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) +) C - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 -) G --- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; -select 1 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_1 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Demographic Criteria -SELECT 0 as index_id, e.person_id, e.event_id -FROM #qualified_events E -JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID -WHERE YEAR(E.start_date) - P.year_of_birth >= 18 -GROUP BY e.person_id, e.event_id --- End Demographic Criteria +-- End Drug Exposure Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) >= 1 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id -select 2 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_2 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +UNION ALL +select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria ) PE JOIN ( @@ -376,18 +308,18 @@ FROM ( select E.person_id, E.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -398,60 +330,86 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C --- End Condition Occurrence Criteria +-- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) >= 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + UNION ALL --- Begin Criteria Group -select 1 as index_id, person_id, event_id -FROM +select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) +) C + +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria + +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from +( + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -459,39 +417,22 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id INNER JOIN ( -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -505,15 +446,15 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL @@ -521,81 +462,158 @@ UNION ALL select 1 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) > 0 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + + ) E + JOIN @cdm_database_schema.observation_period OP on E.person_id = OP.person_id and E.start_date >= OP.observation_period_start_date and E.start_date <= op.observation_period_end_date + WHERE DATEADD(day,183,OP.OBSERVATION_PERIOD_START_DATE) <= E.START_DATE AND DATEADD(day,0,E.START_DATE) <= OP.OBSERVATION_PERIOD_END_DATE +) P +WHERE P.ordinal = 1 +-- End Primary Events + +) +SELECT event_id, person_id, start_date, end_date, op_start_date, op_end_date, visit_occurrence_id +INTO #qualified_events FROM ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C + select pe.event_id, pe.person_id, pe.start_date, pe.end_date, pe.op_start_date, pe.op_end_date, row_number() over (partition by pe.person_id order by pe.start_date ASC) as ordinal, cast(pe.visit_occurrence_id as bigint) as visit_occurrence_id + FROM primary_events pe + +) QE -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date +; + +--- Inclusion Rule Inserts + +select 0 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_0 FROM ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Demographic Criteria +SELECT 0 as index_id, e.person_id, e.event_id +FROM #qualified_events E +JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID +WHERE P.gender_concept_id in (8507) +GROUP BY e.person_id, e.event_id +-- End Demographic Criteria -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; + +select 1 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_1 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Demographic Criteria +SELECT 0 as index_id, e.person_id, e.event_id +FROM #qualified_events E +JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID +WHERE YEAR(E.start_date) - P.year_of_birth >= 18 +GROUP BY e.person_id, e.event_id +-- End Demographic Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; + +select 2 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_2 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -605,7 +623,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C @@ -618,43 +636,11 @@ HAVING COUNT(cc.event_id) = 0 UNION ALL -- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -664,7 +650,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) ) C @@ -677,43 +663,11 @@ HAVING COUNT(cc.event_id) = 0 UNION ALL -- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +select 2 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -723,7 +677,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) ) C @@ -736,43 +690,11 @@ HAVING COUNT(cc.event_id) = 0 UNION ALL -- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +select 3 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -782,7 +704,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) ) C @@ -795,25 +717,11 @@ HAVING COUNT(cc.event_id) = 0 UNION ALL -- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +select 4 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -823,104 +731,48 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 -) G --- End Criteria Group - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 2 + HAVING COUNT(index_id) = 5 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +select 3 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_3 +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria - -) PE + select pe.person_id, pe.event_id + FROM #qualified_events pe + JOIN ( -- Begin Criteria Group select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E + FROM #qualified_events E INNER JOIN ( -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +select 0 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( -- Begin Condition Occurrence Criteria SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, @@ -929,553 +781,115 @@ FROM ( SELECT co.* FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 10) ) C -- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL --- Begin Criteria Group -select 1 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date +-- Begin Correlated Criteria +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date from ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 10) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria +-- End Observation Criteria -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria -UNION ALL --- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 -) G --- End Criteria Group - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id HAVING COUNT(index_id) = 2 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +select 4 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_4 +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria - -) PE + select pe.person_id, pe.event_id + FROM #qualified_events pe + JOIN ( -- Begin Criteria Group select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from + FROM #qualified_events E + INNER JOIN + ( + -- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E + select E.person_id, E.event_id + FROM #qualified_events E INNER JOIN ( -- Begin Correlated Criteria select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( - -- Begin Condition Occurrence Criteria + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Condition Occurrence Criteria SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, C.visit_occurrence_id, C.condition_start_date as sort_date FROM ( - SELECT co.* + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C - +WHERE C.ordinal = 1 -- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL +) PE +JOIN ( -- Begin Criteria Group -select 1 as index_id, person_id, event_id +select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -1483,226 +897,85 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id INNER JOIN ( -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id +select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) >= 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +select 1 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Measurement Criteria +select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, + C.visit_occurrence_id, C.measurement_date as sort_date +from +( + select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal + FROM @cdm_database_schema.MEASUREMENT m +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) +) C + +WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) +AND C.ordinal = 1 +-- End Measurement Criteria + +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date @@ -1710,17 +983,21 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C -WHERE C.ordinal = 1 +WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) +AND C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, @@ -1729,40 +1006,55 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C -WHERE C.ordinal = 1 +WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) +AND C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) >= 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria +select 2 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date from @@ -1774,13 +1066,15 @@ JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id WHERE C.ordinal = 1 -- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date + +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date @@ -1796,30 +1090,11 @@ WHERE C.ordinal = 1 ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria @@ -1839,34 +1114,27 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 -) G --- End Criteria Group - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 2 + HAVING COUNT(index_id) >= 1 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id @@ -1878,63 +1146,13 @@ HAVING COUNT(cc.event_id) >= 1 ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) > 0 -) G --- End Criteria Group - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) >= 1 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; - -select 3 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_3 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from #qualified_events p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - -- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 10) -) C - - --- End Condition Occurrence Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) > 0 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id @@ -1949,7 +1167,9 @@ select inclusion_rule_id, person_id, event_id from #Inclusion_1 UNION ALL select inclusion_rule_id, person_id, event_id from #Inclusion_2 UNION ALL -select inclusion_rule_id, person_id, event_id from #Inclusion_3) I; +select inclusion_rule_id, person_id, event_id from #Inclusion_3 +UNION ALL +select inclusion_rule_id, person_id, event_id from #Inclusion_4) I; TRUNCATE TABLE #Inclusion_0; DROP TABLE #Inclusion_0; @@ -1962,6 +1182,9 @@ DROP TABLE #Inclusion_2; TRUNCATE TABLE #Inclusion_3; DROP TABLE #Inclusion_3; +TRUNCATE TABLE #Inclusion_4; +DROP TABLE #Inclusion_4; + with cteIncludedEvents(event_id, person_id, start_date, end_date, op_start_date, op_end_date, ordinal) as ( @@ -1975,13 +1198,13 @@ with cteIncludedEvents(event_id, person_id, start_date, end_date, op_start_date, ) MG -- matching groups -- the matching group with all bits set ( POWER(2,# of inclusion rules) - 1 = inclusion_rule_mask - WHERE (MG.inclusion_rule_mask = POWER(cast(2 as bigint),4)-1) + WHERE (MG.inclusion_rule_mask = POWER(cast(2 as bigint),5)-1) ) select event_id, person_id, start_date, end_date, op_start_date, op_end_date into #included_events FROM cteIncludedEvents Results -WHERE Results.ordinal = 1 + ; diff --git a/inst/sql/sql_server/110.sql b/inst/sql/sql_server/110.sql index 5edd076..8a46a3b 100644 --- a/inst/sql/sql_server/110.sql +++ b/inst/sql/sql_server/110.sql @@ -7,7 +7,7 @@ CREATE TABLE #Codesets ( INSERT INTO #Codesets (codeset_id, concept_id) SELECT 1 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930,4264861,4264288,4246703,763131) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id @@ -79,11 +79,11 @@ UNION select c.concept_id ) C UNION ALL SELECT 10 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392,4312326) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (443392) + and ca.ancestor_concept_id in (443392,4312326) and c.invalid_reason is null ) I @@ -195,7 +195,8 @@ FROM OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date, cast(E.visit_occurrence_id as bigint) as visit_occurrence_id FROM ( - -- Begin Drug Exposure Criteria + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -209,22 +210,56 @@ JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria -UNION ALL --- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C -WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) --- End Procedure Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from +( + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) +) C -UNION ALL --- Begin Drug Exposure Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date +) P +JOIN ( + -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -235,11 +270,20 @@ from JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) + -- End Drug Exposure Criteria +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria + UNION ALL --- Begin Drug Exposure Criteria +-- Begin Correlated Criteria +select 1 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -247,141 +291,56 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria - - ) E - JOIN @cdm_database_schema.observation_period OP on E.person_id = OP.person_id and E.start_date >= OP.observation_period_start_date and E.start_date <= op.observation_period_end_date - WHERE DATEADD(day,183,OP.OBSERVATION_PERIOD_START_DATE) <= E.START_DATE AND DATEADD(day,0,E.START_DATE) <= OP.OBSERVATION_PERIOD_END_DATE +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P -WHERE P.ordinal = 1 --- End Primary Events - -) -SELECT event_id, person_id, start_date, end_date, op_start_date, op_end_date, visit_occurrence_id -INTO #qualified_events -FROM -( - select pe.event_id, pe.person_id, pe.start_date, pe.end_date, pe.op_start_date, pe.op_end_date, row_number() over (partition by pe.person_id order by pe.start_date ASC) as ordinal, cast(pe.visit_occurrence_id as bigint) as visit_occurrence_id - FROM primary_events pe - -) QE - -; - ---- Inclusion Rule Inserts - -select 0 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_0 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Demographic Criteria -SELECT 0 as index_id, e.person_id, e.event_id -FROM #qualified_events E -JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID -WHERE P.gender_concept_id in (8507) -GROUP BY e.person_id, e.event_id --- End Demographic Criteria + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) +) C - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 -) G --- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; -select 1 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_1 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Demographic Criteria -SELECT 0 as index_id, e.person_id, e.event_id -FROM #qualified_events E -JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID -WHERE YEAR(E.start_date) - P.year_of_birth >= 18 -GROUP BY e.person_id, e.event_id --- End Demographic Criteria +-- End Drug Exposure Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) = 2 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id -select 2 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_2 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +UNION ALL +select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria ) PE JOIN ( @@ -391,18 +350,18 @@ FROM ( select E.person_id, E.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -413,82 +372,18 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - - --- End Condition Occurrence Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Criteria Group -select 1 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -518,18 +413,18 @@ UNION ALL select 1 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -554,47 +449,38 @@ GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 2 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +) PE JOIN ( - -- Begin Drug Exposure Criteria +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -602,52 +488,34 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C - +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -661,52 +529,60 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL --- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +-- Begin Criteria Group +select 1 as index_id, person_id, event_id +FROM ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from +( + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -720,58 +596,23 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +select 1 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria +FROM (-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -779,52 +620,28 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C - +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id @@ -833,7 +650,7 @@ HAVING COUNT(cc.event_id) >= 1 ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 + HAVING COUNT(index_id) > 0 ) G -- End Criteria Group @@ -844,31 +661,21 @@ HAVING COUNT(cc.event_id) >= 1 -- End Criteria Group ) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - UNION ALL --- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date +select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) PE JOIN ( @@ -878,19 +685,19 @@ FROM ( select E.person_id, E.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -901,38 +708,39 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C --- End Condition Occurrence Criteria +-- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria @@ -944,19 +752,19 @@ FROM ( select E.person_id, E.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -967,19 +775,19 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -993,7 +801,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C @@ -1009,84 +817,164 @@ UNION ALL select 1 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) > 0 +) G +-- End Criteria Group -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 2 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date + ) E + JOIN @cdm_database_schema.observation_period OP on E.person_id = OP.person_id and E.start_date >= OP.observation_period_start_date and E.start_date <= op.observation_period_end_date + WHERE DATEADD(day,183,OP.OBSERVATION_PERIOD_START_DATE) <= E.START_DATE AND DATEADD(day,0,E.START_DATE) <= OP.OBSERVATION_PERIOD_END_DATE ) P +WHERE P.ordinal = 1 +-- End Primary Events + +) +SELECT event_id, person_id, start_date, end_date, op_start_date, op_end_date, visit_occurrence_id +INTO #qualified_events +FROM +( + select pe.event_id, pe.person_id, pe.start_date, pe.end_date, pe.op_start_date, pe.op_end_date, row_number() over (partition by pe.person_id order by pe.start_date ASC) as ordinal, cast(pe.visit_occurrence_id as bigint) as visit_occurrence_id + FROM primary_events pe + +) QE + +; + +--- Inclusion Rule Inserts + +select 0 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_0 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Demographic Criteria +SELECT 0 as index_id, e.person_id, e.event_id +FROM #qualified_events E +JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID +WHERE P.gender_concept_id in (8507) +GROUP BY e.person_id, e.event_id +-- End Demographic Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; + +select 1 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_1 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Demographic Criteria +SELECT 0 as index_id, e.person_id, e.event_id +FROM #qualified_events E +JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID +WHERE YEAR(E.start_date) - P.year_of_birth >= 18 +GROUP BY e.person_id, e.event_id +-- End Demographic Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; + +select 2 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_2 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -1096,7 +984,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) ) C @@ -1109,45 +997,11 @@ HAVING COUNT(cc.event_id) = 0 UNION ALL -- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -1157,7 +1011,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) ) C @@ -1170,45 +1024,11 @@ HAVING COUNT(cc.event_id) = 0 UNION ALL -- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +select 2 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -1218,7 +1038,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) ) C @@ -1231,45 +1051,11 @@ HAVING COUNT(cc.event_id) = 0 UNION ALL -- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +select 3 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -1288,134 +1074,39 @@ JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 + HAVING COUNT(index_id) = 4 ) G -- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 2 -) G --- End Criteria Group -) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +select 3 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_3 +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria - -) PE + select pe.person_id, pe.event_id + FROM #qualified_events pe + JOIN ( -- Begin Criteria Group select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E + FROM #qualified_events E INNER JOIN ( -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +select 0 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( -- Begin Condition Occurrence Criteria SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, @@ -1424,245 +1115,201 @@ FROM ( SELECT co.* FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 10) ) C -- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL --- Begin Criteria Group -select 1 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +-- Begin Correlated Criteria +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 10) ) C --- End Drug Exposure Criteria +-- End Observation Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 2 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +select 4 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_4 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +-- End Condition Occurrence Criteria + +) PE JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) >= 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +select 1 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Measurement Criteria +select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, + C.visit_occurrence_id, C.measurement_date as sort_date +from +( + select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal + FROM @cdm_database_schema.MEASUREMENT m +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) +) C + +WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) +AND C.ordinal = 1 +-- End Measurement Criteria + +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date @@ -1670,17 +1317,21 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C -WHERE C.ordinal = 1 +WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) +AND C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, @@ -1689,40 +1340,55 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C -WHERE C.ordinal = 1 +WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) +AND C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) >= 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria +select 2 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date from @@ -1734,13 +1400,15 @@ JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id WHERE C.ordinal = 1 -- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date + +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date @@ -1756,30 +1424,11 @@ WHERE C.ordinal = 1 ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria @@ -1799,34 +1448,27 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 -) G --- End Criteria Group - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 2 + HAVING COUNT(index_id) >= 1 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id @@ -1838,63 +1480,13 @@ HAVING COUNT(cc.event_id) >= 1 ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) > 0 -) G --- End Criteria Group - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) >= 1 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; - -select 3 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_3 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from #qualified_events p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - -- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 10) -) C - - --- End Condition Occurrence Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) > 0 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id @@ -1909,7 +1501,9 @@ select inclusion_rule_id, person_id, event_id from #Inclusion_1 UNION ALL select inclusion_rule_id, person_id, event_id from #Inclusion_2 UNION ALL -select inclusion_rule_id, person_id, event_id from #Inclusion_3) I; +select inclusion_rule_id, person_id, event_id from #Inclusion_3 +UNION ALL +select inclusion_rule_id, person_id, event_id from #Inclusion_4) I; TRUNCATE TABLE #Inclusion_0; DROP TABLE #Inclusion_0; @@ -1922,6 +1516,9 @@ DROP TABLE #Inclusion_2; TRUNCATE TABLE #Inclusion_3; DROP TABLE #Inclusion_3; +TRUNCATE TABLE #Inclusion_4; +DROP TABLE #Inclusion_4; + with cteIncludedEvents(event_id, person_id, start_date, end_date, op_start_date, op_end_date, ordinal) as ( @@ -1935,13 +1532,13 @@ with cteIncludedEvents(event_id, person_id, start_date, end_date, op_start_date, ) MG -- matching groups -- the matching group with all bits set ( POWER(2,# of inclusion rules) - 1 = inclusion_rule_mask - WHERE (MG.inclusion_rule_mask = POWER(cast(2 as bigint),4)-1) + WHERE (MG.inclusion_rule_mask = POWER(cast(2 as bigint),5)-1) ) select event_id, person_id, start_date, end_date, op_start_date, op_end_date into #included_events FROM cteIncludedEvents Results -WHERE Results.ordinal = 1 + ; diff --git a/inst/sql/sql_server/111.sql b/inst/sql/sql_server/111.sql index 61cb482..7d77bc0 100644 --- a/inst/sql/sql_server/111.sql +++ b/inst/sql/sql_server/111.sql @@ -7,7 +7,7 @@ CREATE TABLE #Codesets ( INSERT INTO #Codesets (codeset_id, concept_id) SELECT 1 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930,4264861,4264288,4246703,763131) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id @@ -40,22 +40,17 @@ WHERE E.concept_id is null ) C UNION ALL SELECT 4 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4304921,4145907,4341536) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4304921,4304921,4073142,4073143,4341536,4012324,4073141,4071936,4341536,4145907) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (4304921,4145907,4341536) + and ca.ancestor_concept_id in (4304921,4304921,4073142,4073143,4341536,4012324,4073141,4071936,4341536,4145907) and c.invalid_reason is null ) I LEFT JOIN ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (35608156,35624545,35624534,35624540,35624546,35624535,35624541,35624539,4021070,2780498,2780499,2780496,2780497,2780494,2780495,35624537,35624542,4012324) -UNION select c.concept_id - from @vocabulary_database_schema.CONCEPT c - join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (4012324) - and c.invalid_reason is null + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (35608156,35624545,35624534,35624540,35624546,35624535,35624541,35624539,4021070,2780498,2780499,2780496,2780497,2780494,2780495,35624537,35624542) ) E ON I.concept_id = E.concept_id WHERE E.concept_id is null @@ -84,11 +79,11 @@ UNION select c.concept_id ) C UNION ALL SELECT 10 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392,4312326) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (443392) + and ca.ancestor_concept_id in (443392,4312326) and c.invalid_reason is null ) I @@ -117,55 +112,55 @@ UNION select c.concept_id ) C UNION ALL SELECT 12 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (3169330,4180749) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (40239056,963987,42900250,1361291) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (3169330,4180749) + and ca.ancestor_concept_id in (40239056,963987,42900250,1361291) and c.invalid_reason is null ) I ) C UNION ALL SELECT 13 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (40239056,963987,42900250,1361291) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (1315942,40222431,1378382) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (40239056,963987,42900250,1361291) + and ca.ancestor_concept_id in (1315942,40222431,1378382) and c.invalid_reason is null ) I ) C UNION ALL SELECT 14 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (44816340) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) + and ca.ancestor_concept_id in (44816340) and c.invalid_reason is null ) I ) C UNION ALL SELECT 15 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (1315942,40222431,1378382) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (45892579,1718850) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (1315942,40222431,1378382) + and ca.ancestor_concept_id in (45892579,1718850) and c.invalid_reason is null ) I ) C UNION ALL SELECT 16 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (45892579,1718850) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (45892579,1718850) + and ca.ancestor_concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) and c.invalid_reason is null ) I @@ -189,11 +184,11 @@ WHERE E.concept_id is null ) C UNION ALL SELECT 18 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (44816340) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (3169330,4180749) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (44816340) + and ca.ancestor_concept_id in (3169330,4180749) and c.invalid_reason is null ) I @@ -337,957 +332,125 @@ JOIN ( -- Begin Criteria Group select 0 as index_id, person_id, event_id FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM ( select E.person_id, E.event_id FROM #qualified_events E INNER JOIN ( -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id +select 0 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id FROM #qualified_events P JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) PE -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C +-- End Drug Exposure Criteria -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +UNION ALL +-- Begin Correlated Criteria +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) PE -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C +-- End Drug Exposure Criteria -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +UNION ALL +-- Begin Correlated Criteria +select 2 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( - -- Begin Observation Criteria -select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, - C.visit_occurrence_id, C.observation_date as sort_date + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select o.* - FROM @cdm_database_schema.OBSERVATION o -JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 12) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) ) C --- End Observation Criteria +-- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 -) G --- End Criteria Group -) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id +UNION ALL +-- Begin Correlated Criteria +select 3 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from +( + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) +) C -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Criteria Group -select 1 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 + +-- End Drug Exposure Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria select 4 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 18) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 6 -) G --- End Criteria Group - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 2 -) G --- End Criteria Group -) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria - -) PE -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria - -) PE -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Observation Criteria -select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, - C.visit_occurrence_id, C.observation_date as sort_date -from -( - select o.* - FROM @cdm_database_schema.OBSERVATION o -JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 12) -) C - - --- End Observation Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 -) G --- End Criteria Group -) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Criteria Group -select 1 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -1297,7 +460,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) ) C @@ -1310,45 +473,11 @@ HAVING COUNT(cc.event_id) = 0 UNION ALL -- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +select 5 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -1358,7 +487,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C @@ -1369,165 +498,133 @@ GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria -UNION ALL --- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 6 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +select 3 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_3 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 10) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 18) + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 10) ) C --- End Drug Exposure Criteria +-- End Observation Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 6 -) G --- End Criteria Group - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id HAVING COUNT(index_id) = 2 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, cc.person_id, cc.event_id +select 4 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_4 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM #qualified_events P JOIN ( select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) PE JOIN ( @@ -1537,18 +634,18 @@ FROM ( select E.person_id, E.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM +( + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -1559,18 +656,18 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -1655,20 +752,20 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Observation Criteria -select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, - C.visit_occurrence_id, C.observation_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select o.* - FROM @cdm_database_schema.OBSERVATION o -JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 12) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 18) ) C --- End Observation Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_START_DATE ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria @@ -1680,39 +777,52 @@ HAVING COUNT(cc.event_id) = 0 -- End Criteria Group ) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) >= 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL --- Begin Criteria Group -select 1 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria +-- Begin Correlated Criteria +select 1 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C -WHERE C.ordinal = 1 +WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) +AND C.ordinal = 1 -- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date + +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date @@ -1720,17 +830,21 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C -WHERE C.ordinal = 1 +WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) +AND C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, @@ -1739,110 +853,72 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C -WHERE C.ordinal = 1 +WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) +AND C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C +WHERE C.ordinal = 1 +-- End Condition Occurrence Criteria --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, p.person_id, p.event_id from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -1850,47 +926,73 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id LEFT JOIN ( SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 18) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) >= 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria +select 2 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date from @@ -1902,53 +1004,15 @@ JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id WHERE C.ordinal = 1 -- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +) PE JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 18) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date @@ -1964,9 +1028,12 @@ WHERE C.ordinal = 1 ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, @@ -1985,41 +1052,61 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C +WHERE C.ordinal = 1 +-- End Condition Occurrence Criteria --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM +( + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) +) C -UNION ALL --- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id +WHERE C.ordinal = 1 +-- End Condition Occurrence Criteria +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, p.person_id, p.event_id from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -2027,51 +1114,56 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id LEFT JOIN ( SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 18) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 6 + HAVING COUNT(index_id) = 1 ) G -- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 2 + HAVING COUNT(index_id) >= 1 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id @@ -2083,63 +1175,13 @@ HAVING COUNT(cc.event_id) >= 1 ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) > 0 -) G --- End Criteria Group - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) >= 1 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; - -select 3 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_3 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from #qualified_events p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - -- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 10) -) C - - --- End Condition Occurrence Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) > 0 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id @@ -2154,7 +1196,9 @@ select inclusion_rule_id, person_id, event_id from #Inclusion_1 UNION ALL select inclusion_rule_id, person_id, event_id from #Inclusion_2 UNION ALL -select inclusion_rule_id, person_id, event_id from #Inclusion_3) I; +select inclusion_rule_id, person_id, event_id from #Inclusion_3 +UNION ALL +select inclusion_rule_id, person_id, event_id from #Inclusion_4) I; TRUNCATE TABLE #Inclusion_0; DROP TABLE #Inclusion_0; @@ -2167,6 +1211,9 @@ DROP TABLE #Inclusion_2; TRUNCATE TABLE #Inclusion_3; DROP TABLE #Inclusion_3; +TRUNCATE TABLE #Inclusion_4; +DROP TABLE #Inclusion_4; + with cteIncludedEvents(event_id, person_id, start_date, end_date, op_start_date, op_end_date, ordinal) as ( @@ -2180,13 +1227,13 @@ with cteIncludedEvents(event_id, person_id, start_date, end_date, op_start_date, ) MG -- matching groups -- the matching group with all bits set ( POWER(2,# of inclusion rules) - 1 = inclusion_rule_mask - WHERE (MG.inclusion_rule_mask = POWER(cast(2 as bigint),4)-1) + WHERE (MG.inclusion_rule_mask = POWER(cast(2 as bigint),5)-1) ) select event_id, person_id, start_date, end_date, op_start_date, op_end_date into #included_events FROM cteIncludedEvents Results -WHERE Results.ordinal = 1 + ; diff --git a/inst/sql/sql_server/112.sql b/inst/sql/sql_server/112.sql index 4acbd8c..be7dd2b 100644 --- a/inst/sql/sql_server/112.sql +++ b/inst/sql/sql_server/112.sql @@ -7,7 +7,7 @@ CREATE TABLE #Codesets ( INSERT INTO #Codesets (codeset_id, concept_id) SELECT 1 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930,4264861,4264288,4246703,763131) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id @@ -40,22 +40,17 @@ WHERE E.concept_id is null ) C UNION ALL SELECT 4 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4304921,4145907,4341536) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4304921,4304921,4073142,4073143,4341536,4012324,4073141,4071936,4341536,4145907) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (4304921,4145907,4341536) + and ca.ancestor_concept_id in (4304921,4304921,4073142,4073143,4341536,4012324,4073141,4071936,4341536,4145907) and c.invalid_reason is null ) I LEFT JOIN ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (35608156,35624545,35624534,35624540,35624546,35624535,35624541,35624539,4021070,2780498,2780499,2780496,2780497,2780494,2780495,35624537,35624542,4012324) -UNION select c.concept_id - from @vocabulary_database_schema.CONCEPT c - join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (4012324) - and c.invalid_reason is null + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (35608156,35624545,35624534,35624540,35624546,35624535,35624541,35624539,4021070,2780498,2780499,2780496,2780497,2780494,2780495,35624537,35624542) ) E ON I.concept_id = E.concept_id WHERE E.concept_id is null @@ -84,11 +79,11 @@ UNION select c.concept_id ) C UNION ALL SELECT 10 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392,4312326) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (443392) + and ca.ancestor_concept_id in (443392,4312326) and c.invalid_reason is null ) I @@ -117,55 +112,55 @@ UNION select c.concept_id ) C UNION ALL SELECT 12 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (3169330,4180749) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (40239056,963987,42900250,1361291) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (3169330,4180749) + and ca.ancestor_concept_id in (40239056,963987,42900250,1361291) and c.invalid_reason is null ) I ) C UNION ALL SELECT 13 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (40239056,963987,42900250,1361291) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (1315942,40222431,1378382) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (40239056,963987,42900250,1361291) + and ca.ancestor_concept_id in (1315942,40222431,1378382) and c.invalid_reason is null ) I ) C UNION ALL SELECT 14 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (44816340) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) + and ca.ancestor_concept_id in (44816340) and c.invalid_reason is null ) I ) C UNION ALL SELECT 15 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (1315942,40222431,1378382) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (45892579,1718850) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (1315942,40222431,1378382) + and ca.ancestor_concept_id in (45892579,1718850) and c.invalid_reason is null ) I ) C UNION ALL SELECT 16 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (45892579,1718850) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (45892579,1718850) + and ca.ancestor_concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) and c.invalid_reason is null ) I @@ -189,11 +184,11 @@ WHERE E.concept_id is null ) C UNION ALL SELECT 18 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (44816340) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (3169330,4180749) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (44816340) + and ca.ancestor_concept_id in (3169330,4180749) and c.invalid_reason is null ) I @@ -211,7 +206,8 @@ FROM OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date, cast(E.visit_occurrence_id as bigint) as visit_occurrence_id FROM ( - -- Begin Drug Exposure Criteria + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -225,22 +221,38 @@ JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria -UNION ALL --- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C -WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) --- End Procedure Occurrence Criteria - -UNION ALL --- Begin Drug Exposure Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -248,141 +260,56 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria - - ) E - JOIN @cdm_database_schema.observation_period OP on E.person_id = OP.person_id and E.start_date >= OP.observation_period_start_date and E.start_date <= op.observation_period_end_date - WHERE DATEADD(day,183,OP.OBSERVATION_PERIOD_START_DATE) <= E.START_DATE AND DATEADD(day,0,E.START_DATE) <= OP.OBSERVATION_PERIOD_END_DATE +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P -WHERE P.ordinal = 1 --- End Primary Events - -) -SELECT event_id, person_id, start_date, end_date, op_start_date, op_end_date, visit_occurrence_id -INTO #qualified_events -FROM -( - select pe.event_id, pe.person_id, pe.start_date, pe.end_date, pe.op_start_date, pe.op_end_date, row_number() over (partition by pe.person_id order by pe.start_date ASC) as ordinal, cast(pe.visit_occurrence_id as bigint) as visit_occurrence_id - FROM primary_events pe - -) QE - -; - ---- Inclusion Rule Inserts - -select 0 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_0 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Demographic Criteria -SELECT 0 as index_id, e.person_id, e.event_id -FROM #qualified_events E -JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID -WHERE P.gender_concept_id in (8507) -GROUP BY e.person_id, e.event_id --- End Demographic Criteria + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) +) C - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 -) G --- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; -select 1 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_1 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Demographic Criteria -SELECT 0 as index_id, e.person_id, e.event_id -FROM #qualified_events E -JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID -WHERE YEAR(E.start_date) - P.year_of_birth >= 18 -GROUP BY e.person_id, e.event_id --- End Demographic Criteria +-- End Drug Exposure Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) >= 1 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id -select 2 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_2 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +UNION ALL +select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria ) PE JOIN ( @@ -392,18 +319,18 @@ FROM ( select E.person_id, E.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -414,798 +341,52 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria - -) PE -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Observation Criteria -select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, - C.visit_occurrence_id, C.observation_date as sort_date -from -( - select o.* - FROM @cdm_database_schema.OBSERVATION o -JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 12) -) C - - --- End Observation Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 -) G --- End Criteria Group -) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Criteria Group -select 1 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 18) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 5 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 -) G --- End Criteria Group - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 2 -) G --- End Criteria Group -) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria - -) PE -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria - -) PE -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Observation Criteria -select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, - C.visit_occurrence_id, C.observation_date as sort_date + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select o.* - FROM @cdm_database_schema.OBSERVATION o -JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 12) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C --- End Observation Criteria +-- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) >= 1 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - UNION ALL --- Begin Criteria Group -select 1 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria +select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -1213,60 +394,21 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C - +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +) PE JOIN ( - -- Begin Drug Exposure Criteria +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -1274,54 +416,34 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C - +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -1335,58 +457,174 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date +select 1 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date +) P +JOIN ( + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date + +-- End Procedure Occurrence Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) > 0 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + + ) E + JOIN @cdm_database_schema.observation_period OP on E.person_id = OP.person_id and E.start_date >= OP.observation_period_start_date and E.start_date <= op.observation_period_end_date + WHERE DATEADD(day,183,OP.OBSERVATION_PERIOD_START_DATE) <= E.START_DATE AND DATEADD(day,0,E.START_DATE) <= OP.OBSERVATION_PERIOD_END_DATE ) P +WHERE P.ordinal = 1 +-- End Primary Events + +) +SELECT event_id, person_id, start_date, end_date, op_start_date, op_end_date, visit_occurrence_id +INTO #qualified_events +FROM +( + select pe.event_id, pe.person_id, pe.start_date, pe.end_date, pe.op_start_date, pe.op_end_date, row_number() over (partition by pe.person_id order by pe.start_date ASC) as ordinal, cast(pe.visit_occurrence_id as bigint) as visit_occurrence_id + FROM primary_events pe + +) QE + +; + +--- Inclusion Rule Inserts + +select 0 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_0 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Demographic Criteria +SELECT 0 as index_id, e.person_id, e.event_id +FROM #qualified_events E +JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID +WHERE P.gender_concept_id in (8507) +GROUP BY e.person_id, e.event_id +-- End Demographic Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; + +select 1 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_1 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Demographic Criteria +SELECT 0 as index_id, e.person_id, e.event_id +FROM #qualified_events E +JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID +WHERE YEAR(E.start_date) - P.year_of_birth >= 18 +GROUP BY e.person_id, e.event_id +-- End Demographic Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; + +select 2 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_2 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -1396,7 +634,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C @@ -1409,45 +647,11 @@ HAVING COUNT(cc.event_id) = 0 UNION ALL -- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -1457,7 +661,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 18) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) ) C @@ -1470,26 +674,38 @@ HAVING COUNT(cc.event_id) = 0 UNION ALL -- Begin Correlated Criteria -select 5 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date +select 2 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P + +-- End Drug Exposure Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria + +UNION ALL +-- Begin Correlated Criteria +select 3 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -1499,39 +715,24 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +select 4 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -1541,101 +742,130 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 + HAVING COUNT(index_id) = 5 ) G -- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 2 -) G --- End Criteria Group -) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id +select 3 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_3 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM +( + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 10) +) C -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 + +-- End Condition Occurrence Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 2 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id FROM #qualified_events P JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date from ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 10) ) C -WHERE C.ordinal = 1 --- End Measurement Criteria -) PE +-- End Observation Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 2 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; + +select 4 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_4 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + JOIN ( -- Begin Criteria Group select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from + FROM #qualified_events E + INNER JOIN + ( + -- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E + select E.person_id, E.event_id + FROM #qualified_events E INNER JOIN ( -- Begin Correlated Criteria select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( -- Begin Condition Occurrence Criteria @@ -1645,7 +875,7 @@ FROM ( SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 @@ -1666,7 +896,7 @@ FROM ( SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 @@ -1678,8 +908,9 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id INNER JOIN ( -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Condition Occurrence Criteria SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, C.visit_occurrence_id, C.condition_start_date as sort_date @@ -1687,7 +918,7 @@ FROM ( SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 @@ -1695,11 +926,10 @@ WHERE C.ordinal = 1 ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria +) P +JOIN ( + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Condition Occurrence Criteria SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, C.visit_occurrence_id, C.condition_start_date as sort_date FROM @@ -1711,60 +941,27 @@ FROM WHERE C.ordinal = 1 -- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Observation Criteria -select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, - C.visit_occurrence_id, C.observation_date as sort_date -from -( - select o.* - FROM @cdm_database_schema.OBSERVATION o -JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 12) -) C - --- End Observation Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 -) G --- End Criteria Group -) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL +) PE +JOIN ( -- Begin Criteria Group -select 1 as index_id, person_id, event_id +select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -1774,18 +971,18 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id -- Begin Correlated Criteria select 0 as index_id, p.person_id, p.event_id from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -1793,105 +990,94 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id LEFT JOIN ( SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 18) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_START_DATE ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) >= 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria +select 1 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C -WHERE C.ordinal = 1 +WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) +AND C.ordinal = 1 -- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +) PE JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date @@ -1899,17 +1085,21 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C -WHERE C.ordinal = 1 +WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) +AND C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, @@ -1918,51 +1108,72 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C -WHERE C.ordinal = 1 +WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) +AND C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 18) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C +WHERE C.ordinal = 1 +-- End Condition Occurrence Criteria --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM +( + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) +) C -UNION ALL --- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id +WHERE C.ordinal = 1 +-- End Condition Occurrence Criteria +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, p.person_id, p.event_id from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -1970,47 +1181,73 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id LEFT JOIN ( SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 18) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) >= 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria +select 2 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date from @@ -2022,13 +1259,15 @@ JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id WHERE C.ordinal = 1 -- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date + +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date @@ -2044,30 +1283,11 @@ WHERE C.ordinal = 1 ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 5 as index_id, cc.person_id, cc.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria @@ -2087,75 +1307,118 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C +WHERE C.ordinal = 1 +-- End Condition Occurrence Criteria --- End Drug Exposure Criteria +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM +( + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) +) C -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria +WHERE C.ordinal = 1 +-- End Condition Occurrence Criteria +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, p.person_id, p.event_id +from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM +( + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) +) C -UNION ALL --- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id +WHERE C.ordinal = 1 +-- End Condition Occurrence Criteria +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date +) p +LEFT JOIN ( +SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 18) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 + HAVING COUNT(index_id) = 1 ) G -- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 2 + HAVING COUNT(index_id) >= 1 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id @@ -2167,63 +1430,13 @@ HAVING COUNT(cc.event_id) >= 1 ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) > 0 -) G --- End Criteria Group - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) >= 1 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; - -select 3 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_3 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from #qualified_events p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - -- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 10) -) C - - --- End Condition Occurrence Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) > 0 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id @@ -2238,7 +1451,9 @@ select inclusion_rule_id, person_id, event_id from #Inclusion_1 UNION ALL select inclusion_rule_id, person_id, event_id from #Inclusion_2 UNION ALL -select inclusion_rule_id, person_id, event_id from #Inclusion_3) I; +select inclusion_rule_id, person_id, event_id from #Inclusion_3 +UNION ALL +select inclusion_rule_id, person_id, event_id from #Inclusion_4) I; TRUNCATE TABLE #Inclusion_0; DROP TABLE #Inclusion_0; @@ -2251,6 +1466,9 @@ DROP TABLE #Inclusion_2; TRUNCATE TABLE #Inclusion_3; DROP TABLE #Inclusion_3; +TRUNCATE TABLE #Inclusion_4; +DROP TABLE #Inclusion_4; + with cteIncludedEvents(event_id, person_id, start_date, end_date, op_start_date, op_end_date, ordinal) as ( @@ -2264,13 +1482,13 @@ with cteIncludedEvents(event_id, person_id, start_date, end_date, op_start_date, ) MG -- matching groups -- the matching group with all bits set ( POWER(2,# of inclusion rules) - 1 = inclusion_rule_mask - WHERE (MG.inclusion_rule_mask = POWER(cast(2 as bigint),4)-1) + WHERE (MG.inclusion_rule_mask = POWER(cast(2 as bigint),5)-1) ) select event_id, person_id, start_date, end_date, op_start_date, op_end_date into #included_events FROM cteIncludedEvents Results -WHERE Results.ordinal = 1 + ; diff --git a/inst/sql/sql_server/113.sql b/inst/sql/sql_server/113.sql index ad420b9..16dc8fa 100644 --- a/inst/sql/sql_server/113.sql +++ b/inst/sql/sql_server/113.sql @@ -7,7 +7,7 @@ CREATE TABLE #Codesets ( INSERT INTO #Codesets (codeset_id, concept_id) SELECT 1 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930,4264861,4264288,4246703,763131) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id @@ -40,22 +40,17 @@ WHERE E.concept_id is null ) C UNION ALL SELECT 4 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4304921,4145907,4341536) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4304921,4304921,4073142,4073143,4341536,4012324,4073141,4071936,4341536,4145907) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (4304921,4145907,4341536) + and ca.ancestor_concept_id in (4304921,4304921,4073142,4073143,4341536,4012324,4073141,4071936,4341536,4145907) and c.invalid_reason is null ) I LEFT JOIN ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (35608156,35624545,35624534,35624540,35624546,35624535,35624541,35624539,4021070,2780498,2780499,2780496,2780497,2780494,2780495,35624537,35624542,4012324) -UNION select c.concept_id - from @vocabulary_database_schema.CONCEPT c - join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (4012324) - and c.invalid_reason is null + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (35608156,35624545,35624534,35624540,35624546,35624535,35624541,35624539,4021070,2780498,2780499,2780496,2780497,2780494,2780495,35624537,35624542) ) E ON I.concept_id = E.concept_id WHERE E.concept_id is null @@ -80,26 +75,15 @@ UNION select c.concept_id and ca.ancestor_concept_id in (3006575) and c.invalid_reason is null -) I -) C UNION ALL -SELECT 9 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM -( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (40239056,963987,1344381,1361291,1315942,1349025,42900250) -UNION select c.concept_id - from @vocabulary_database_schema.CONCEPT c - join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (40239056,963987,1344381,1361291,1315942,1349025,42900250) - and c.invalid_reason is null - ) I ) C UNION ALL SELECT 10 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392,4312326) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (443392) + and ca.ancestor_concept_id in (443392,4312326) and c.invalid_reason is null ) I @@ -128,55 +112,55 @@ UNION select c.concept_id ) C UNION ALL SELECT 12 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (3169330,4180749) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (40239056,963987,42900250,1361291) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (3169330,4180749) + and ca.ancestor_concept_id in (40239056,963987,42900250,1361291) and c.invalid_reason is null ) I ) C UNION ALL SELECT 13 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (40239056,963987,42900250,1361291) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (1315942,40222431,1378382) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (40239056,963987,42900250,1361291) + and ca.ancestor_concept_id in (1315942,40222431,1378382) and c.invalid_reason is null ) I ) C UNION ALL SELECT 14 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (44816340) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) + and ca.ancestor_concept_id in (44816340) and c.invalid_reason is null ) I ) C UNION ALL SELECT 15 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (1315942,40222431,1378382) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (45892579,1718850) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (1315942,40222431,1378382) + and ca.ancestor_concept_id in (45892579,1718850) and c.invalid_reason is null ) I ) C UNION ALL SELECT 16 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (45892579,1718850) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (45892579,1718850) + and ca.ancestor_concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) and c.invalid_reason is null ) I @@ -200,11 +184,11 @@ WHERE E.concept_id is null ) C UNION ALL SELECT 18 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (44816340) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (3169330,4180749) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (44816340) + and ca.ancestor_concept_id in (3169330,4180749) and c.invalid_reason is null ) I @@ -222,7 +206,8 @@ FROM OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date, cast(E.visit_occurrence_id as bigint) as visit_occurrence_id FROM ( - -- Begin Drug Exposure Criteria + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -236,22 +221,38 @@ JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria -UNION ALL --- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C -WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) --- End Procedure Occurrence Criteria - -UNION ALL --- Begin Drug Exposure Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -259,141 +260,56 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria - - ) E - JOIN @cdm_database_schema.observation_period OP on E.person_id = OP.person_id and E.start_date >= OP.observation_period_start_date and E.start_date <= op.observation_period_end_date - WHERE DATEADD(day,183,OP.OBSERVATION_PERIOD_START_DATE) <= E.START_DATE AND DATEADD(day,0,E.START_DATE) <= OP.OBSERVATION_PERIOD_END_DATE +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P -WHERE P.ordinal = 1 --- End Primary Events - -) -SELECT event_id, person_id, start_date, end_date, op_start_date, op_end_date, visit_occurrence_id -INTO #qualified_events -FROM -( - select pe.event_id, pe.person_id, pe.start_date, pe.end_date, pe.op_start_date, pe.op_end_date, row_number() over (partition by pe.person_id order by pe.start_date ASC) as ordinal, cast(pe.visit_occurrence_id as bigint) as visit_occurrence_id - FROM primary_events pe - -) QE - -; - ---- Inclusion Rule Inserts - -select 0 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_0 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Demographic Criteria -SELECT 0 as index_id, e.person_id, e.event_id -FROM #qualified_events E -JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID -WHERE P.gender_concept_id in (8507) -GROUP BY e.person_id, e.event_id --- End Demographic Criteria + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) +) C - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 -) G --- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; -select 1 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_1 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Demographic Criteria -SELECT 0 as index_id, e.person_id, e.event_id -FROM #qualified_events E -JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID -WHERE YEAR(E.start_date) - P.year_of_birth >= 18 -GROUP BY e.person_id, e.event_id --- End Demographic Criteria +-- End Drug Exposure Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) >= 1 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id -select 2 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_2 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +UNION ALL +select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria ) PE JOIN ( @@ -403,18 +319,18 @@ FROM ( select E.person_id, E.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -425,151 +341,86 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria - -) PE -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Observation Criteria -select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, - C.visit_occurrence_id, C.observation_date as sort_date + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select o.* - FROM @cdm_database_schema.OBSERVATION o -JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 12) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C --- End Observation Criteria +-- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) >= 1 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - UNION ALL +select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from +( + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) +) C + +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria + +) PE +JOIN ( -- Begin Criteria Group -select 1 as index_id, person_id, event_id +select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -577,45 +428,10 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id INNER JOIN ( -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria +FROM (-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -626,49 +442,8 @@ from JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C - +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -682,40 +457,23 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 2 as index_id, cc.person_id, cc.event_id +select 1 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria +FROM (-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -723,174 +481,150 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C - +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria -UNION ALL --- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) > 0 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + + ) E + JOIN @cdm_database_schema.observation_period OP on E.person_id = OP.person_id and E.start_date >= OP.observation_period_start_date and E.start_date <= op.observation_period_end_date + WHERE DATEADD(day,183,OP.OBSERVATION_PERIOD_START_DATE) <= E.START_DATE AND DATEADD(day,0,E.START_DATE) <= OP.OBSERVATION_PERIOD_END_DATE +) P +WHERE P.ordinal = 1 +-- End Primary Events + +) +SELECT event_id, person_id, start_date, end_date, op_start_date, op_end_date, visit_occurrence_id +INTO #qualified_events FROM ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C + select pe.event_id, pe.person_id, pe.start_date, pe.end_date, pe.op_start_date, pe.op_end_date, row_number() over (partition by pe.person_id order by pe.start_date ASC) as ordinal, cast(pe.visit_occurrence_id as bigint) as visit_occurrence_id + FROM primary_events pe + +) QE -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date +; + +--- Inclusion Rule Inserts + +select 0 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_0 FROM ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P + select pe.person_id, pe.event_id + FROM #qualified_events pe + JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) -) C + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Demographic Criteria +SELECT 0 as index_id, e.person_id, e.event_id +FROM #qualified_events E +JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID +WHERE P.gender_concept_id in (8507) +GROUP BY e.person_id, e.event_id +-- End Demographic Criteria + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; --- End Drug Exposure Criteria +select 1 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_1 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Demographic Criteria +SELECT 0 as index_id, e.person_id, e.event_id +FROM #qualified_events E +JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID +WHERE YEAR(E.start_date) - P.year_of_birth >= 18 +GROUP BY e.person_id, e.event_id +-- End Demographic Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; -UNION ALL --- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date +select 2 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_2 FROM ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -900,7 +634,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 18) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C @@ -908,538 +642,16 @@ JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 18) ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 -) G --- End Criteria Group - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 2 -) G --- End Criteria Group -) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria - -) PE -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria - -) PE -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Observation Criteria -select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, - C.visit_occurrence_id, C.observation_date as sort_date -from -( - select o.* - FROM @cdm_database_schema.OBSERVATION o -JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 12) -) C - - --- End Observation Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 -) G --- End Criteria Group -) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Criteria Group -select 1 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria + +UNION ALL +-- Begin Correlated Criteria +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -1449,7 +661,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) ) C @@ -1462,45 +674,11 @@ HAVING COUNT(cc.event_id) = 0 UNION ALL -- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +select 2 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -1510,7 +688,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 18) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) ) C @@ -1523,26 +701,38 @@ HAVING COUNT(cc.event_id) = 0 UNION ALL -- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date +select 3 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P + +-- End Drug Exposure Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria + +UNION ALL +-- Begin Correlated Criteria +select 4 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -1552,54 +742,144 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 + HAVING COUNT(index_id) = 5 ) G -- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; + +select 3 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_3 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM +( + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 10) +) C + + +-- End Condition Occurrence Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria + +UNION ALL +-- Begin Correlated Criteria +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date +from +( + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 10) +) C + + +-- End Observation Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id HAVING COUNT(index_id) = 2 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, cc.person_id, cc.event_id +select 4 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_4 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM #qualified_events P JOIN ( select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) PE JOIN ( @@ -1609,18 +889,18 @@ FROM ( select E.person_id, E.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -1631,18 +911,18 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -1727,20 +1007,20 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Observation Criteria -select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, - C.visit_occurrence_id, C.observation_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select o.* - FROM @cdm_database_schema.OBSERVATION o -JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 12) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 18) ) C --- End Observation Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_START_DATE ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria @@ -1752,39 +1032,52 @@ HAVING COUNT(cc.event_id) = 0 -- End Criteria Group ) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) >= 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL --- Begin Criteria Group -select 1 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria +-- Begin Correlated Criteria +select 1 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C -WHERE C.ordinal = 1 +WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) +AND C.ordinal = 1 -- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date + +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date @@ -1792,17 +1085,21 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C -WHERE C.ordinal = 1 +WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) +AND C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, @@ -1811,92 +1108,72 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C -WHERE C.ordinal = 1 +WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) +AND C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C +WHERE C.ordinal = 1 +-- End Condition Occurrence Criteria --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM +( + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, p.person_id, p.event_id from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -1904,66 +1181,73 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id LEFT JOIN ( SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 18) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria -UNION ALL --- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) >= 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria + +UNION ALL +-- Begin Correlated Criteria +select 2 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date from @@ -1975,34 +1259,15 @@ JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id WHERE C.ordinal = 1 -- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P + +) PE JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 18) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date @@ -2018,9 +1283,12 @@ WHERE C.ordinal = 1 ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, @@ -2039,134 +1307,118 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C +WHERE C.ordinal = 1 +-- End Condition Occurrence Criteria --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM +( + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, p.person_id, p.event_id +from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id +) p +LEFT JOIN ( +SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 18) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 + HAVING COUNT(index_id) = 1 ) G -- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 2 + HAVING COUNT(index_id) >= 1 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id @@ -2178,63 +1430,13 @@ HAVING COUNT(cc.event_id) >= 1 ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) > 0 -) G --- End Criteria Group - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) >= 1 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; - -select 3 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_3 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from #qualified_events p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - -- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 10) -) C - - --- End Condition Occurrence Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) > 0 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id @@ -2249,7 +1451,9 @@ select inclusion_rule_id, person_id, event_id from #Inclusion_1 UNION ALL select inclusion_rule_id, person_id, event_id from #Inclusion_2 UNION ALL -select inclusion_rule_id, person_id, event_id from #Inclusion_3) I; +select inclusion_rule_id, person_id, event_id from #Inclusion_3 +UNION ALL +select inclusion_rule_id, person_id, event_id from #Inclusion_4) I; TRUNCATE TABLE #Inclusion_0; DROP TABLE #Inclusion_0; @@ -2262,6 +1466,9 @@ DROP TABLE #Inclusion_2; TRUNCATE TABLE #Inclusion_3; DROP TABLE #Inclusion_3; +TRUNCATE TABLE #Inclusion_4; +DROP TABLE #Inclusion_4; + with cteIncludedEvents(event_id, person_id, start_date, end_date, op_start_date, op_end_date, ordinal) as ( @@ -2275,13 +1482,13 @@ with cteIncludedEvents(event_id, person_id, start_date, end_date, op_start_date, ) MG -- matching groups -- the matching group with all bits set ( POWER(2,# of inclusion rules) - 1 = inclusion_rule_mask - WHERE (MG.inclusion_rule_mask = POWER(cast(2 as bigint),4)-1) + WHERE (MG.inclusion_rule_mask = POWER(cast(2 as bigint),5)-1) ) select event_id, person_id, start_date, end_date, op_start_date, op_end_date into #included_events FROM cteIncludedEvents Results -WHERE Results.ordinal = 1 + ; diff --git a/inst/sql/sql_server/114.sql b/inst/sql/sql_server/114.sql index f4a9458..daf2587 100644 --- a/inst/sql/sql_server/114.sql +++ b/inst/sql/sql_server/114.sql @@ -7,7 +7,7 @@ CREATE TABLE #Codesets ( INSERT INTO #Codesets (codeset_id, concept_id) SELECT 1 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930,4264861,4264288,4246703,763131) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id @@ -40,22 +40,17 @@ WHERE E.concept_id is null ) C UNION ALL SELECT 4 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4304921,4145907,4341536) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4304921,4304921,4073142,4073143,4341536,4012324,4073141,4071936,4341536,4145907) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (4304921,4145907,4341536) + and ca.ancestor_concept_id in (4304921,4304921,4073142,4073143,4341536,4012324,4073141,4071936,4341536,4145907) and c.invalid_reason is null ) I LEFT JOIN ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (35608156,35624545,35624534,35624540,35624546,35624535,35624541,35624539,4021070,2780498,2780499,2780496,2780497,2780494,2780495,35624537,35624542,4012324) -UNION select c.concept_id - from @vocabulary_database_schema.CONCEPT c - join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (4012324) - and c.invalid_reason is null + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (35608156,35624545,35624534,35624540,35624546,35624535,35624541,35624539,4021070,2780498,2780499,2780496,2780497,2780494,2780495,35624537,35624542) ) E ON I.concept_id = E.concept_id WHERE E.concept_id is null @@ -84,11 +79,11 @@ UNION select c.concept_id ) C UNION ALL SELECT 10 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392,4312326) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (443392) + and ca.ancestor_concept_id in (443392,4312326) and c.invalid_reason is null ) I @@ -117,55 +112,55 @@ UNION select c.concept_id ) C UNION ALL SELECT 12 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (3169330,4180749) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (40239056,963987,42900250,1361291) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (3169330,4180749) + and ca.ancestor_concept_id in (40239056,963987,42900250,1361291) and c.invalid_reason is null ) I ) C UNION ALL SELECT 13 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (40239056,963987,42900250,1361291) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (1315942,40222431,1378382) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (40239056,963987,42900250,1361291) + and ca.ancestor_concept_id in (1315942,40222431,1378382) and c.invalid_reason is null ) I ) C UNION ALL SELECT 14 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (44816340) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) + and ca.ancestor_concept_id in (44816340) and c.invalid_reason is null ) I ) C UNION ALL SELECT 15 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (1315942,40222431,1378382) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (45892579,1718850) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (1315942,40222431,1378382) + and ca.ancestor_concept_id in (45892579,1718850) and c.invalid_reason is null ) I ) C UNION ALL SELECT 16 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (45892579,1718850) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (45892579,1718850) + and ca.ancestor_concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) and c.invalid_reason is null ) I @@ -189,11 +184,11 @@ WHERE E.concept_id is null ) C UNION ALL SELECT 18 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (44816340) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (3169330,4180749) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (44816340) + and ca.ancestor_concept_id in (3169330,4180749) and c.invalid_reason is null ) I @@ -211,7 +206,8 @@ FROM OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date, cast(E.visit_occurrence_id as bigint) as visit_occurrence_id FROM ( - -- Begin Drug Exposure Criteria + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -225,22 +221,38 @@ JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria -UNION ALL --- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C -WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) --- End Procedure Occurrence Criteria - -UNION ALL --- Begin Drug Exposure Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -248,14 +260,41 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date +) P +JOIN ( + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from +( + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) +) C + + -- End Drug Exposure Criteria +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria + UNION ALL --- Begin Drug Exposure Criteria +-- Begin Correlated Criteria +select 1 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -263,202 +302,186 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria - - ) E - JOIN @cdm_database_schema.observation_period OP on E.person_id = OP.person_id and E.start_date >= OP.observation_period_start_date and E.start_date <= op.observation_period_end_date - WHERE DATEADD(day,183,OP.OBSERVATION_PERIOD_START_DATE) <= E.START_DATE AND DATEADD(day,0,E.START_DATE) <= OP.OBSERVATION_PERIOD_END_DATE +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P -WHERE P.ordinal = 1 --- End Primary Events - -) -SELECT event_id, person_id, start_date, end_date, op_start_date, op_end_date, visit_occurrence_id -INTO #qualified_events -FROM +JOIN ( + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - select pe.event_id, pe.person_id, pe.start_date, pe.end_date, pe.op_start_date, pe.op_end_date, row_number() over (partition by pe.person_id order by pe.start_date ASC) as ordinal, cast(pe.visit_occurrence_id as bigint) as visit_occurrence_id - FROM primary_events pe - -) QE + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) +) C -; ---- Inclusion Rule Inserts +-- End Drug Exposure Criteria -select 0 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_0 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Demographic Criteria -SELECT 0 as index_id, e.person_id, e.event_id -FROM #qualified_events E -JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID -WHERE P.gender_concept_id in (8507) -GROUP BY e.person_id, e.event_id --- End Demographic Criteria +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) = 2 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id -select 1 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_1 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM +UNION ALL +select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Demographic Criteria -SELECT 0 as index_id, e.person_id, e.event_id -FROM #qualified_events E -JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID -WHERE YEAR(E.start_date) - P.year_of_birth >= 18 -GROUP BY e.person_id, e.event_id --- End Demographic Criteria + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) +) C - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 -) G --- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria -select 2 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_2 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - +) PE JOIN ( -- Begin Criteria Group select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - select E.person_id, E.event_id - FROM #qualified_events E + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) +) C + +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date +) E INNER JOIN ( -- Begin Correlated Criteria select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria - -) PE +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date +) P JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id + +-- End Drug Exposure Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria + +UNION ALL +-- Begin Correlated Criteria +select 1 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria + +-- End Drug Exposure Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 2 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + +UNION ALL +select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from +( + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) +) C + +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) PE JOIN ( @@ -468,18 +491,19 @@ FROM ( select E.person_id, E.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -487,70 +511,42 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id INNER JOIN ( -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Observation Criteria -select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, - C.visit_occurrence_id, C.observation_date as sort_date + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select o.* - FROM @cdm_database_schema.OBSERVATION o -JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 12) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C --- End Observation Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 -) G --- End Criteria Group -) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id +-- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria @@ -562,18 +558,19 @@ FROM ( select E.person_id, E.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -581,39 +578,22 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id INNER JOIN ( -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -627,117 +607,74 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +select 1 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) > 0 +) G +-- End Criteria Group -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 2 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria +UNION ALL +select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -745,52 +682,56 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C - +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from +( + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -804,40 +745,25 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 18) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL --- Begin Correlated Criteria -select 4 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +-- Begin Criteria Group +select 1 as index_id, person_id, event_id +FROM ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -848,49 +774,48 @@ from JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C - +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 5 as index_id, cc.person_id, cc.event_id +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Device Exposure Criteria +select C.person_id, C.device_exposure_id as event_id, C.device_exposure_start_date as start_date, COALESCE(C.device_exposure_end_date, DATEADD(day,1,C.device_exposure_start_date)) as end_date, + C.visit_occurrence_id, C.device_exposure_start_date as sort_date from ( select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) + FROM @cdm_database_schema.DEVICE_EXPOSURE de +JOIN #Codesets cs on (de.device_concept_id = cs.concept_id and cs.codeset_id = 11) ) C --- End Drug Exposure Criteria +-- End Device Exposure Criteria ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id @@ -899,39 +824,39 @@ HAVING COUNT(cc.event_id) >= 1 UNION ALL -- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id +select 1 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id @@ -940,7 +865,7 @@ HAVING COUNT(cc.event_id) >= 1 ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 + HAVING COUNT(index_id) > 0 ) G -- End Criteria Group @@ -951,439 +876,115 @@ HAVING COUNT(cc.event_id) >= 1 -- End Criteria Group ) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria + ) E + JOIN @cdm_database_schema.observation_period OP on E.person_id = OP.person_id and E.start_date >= OP.observation_period_start_date and E.start_date <= op.observation_period_end_date + WHERE DATEADD(day,183,OP.OBSERVATION_PERIOD_START_DATE) <= E.START_DATE AND DATEADD(day,0,E.START_DATE) <= OP.OBSERVATION_PERIOD_END_DATE +) P +WHERE P.ordinal = 1 +-- End Primary Events -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +) +SELECT event_id, person_id, start_date, end_date, op_start_date, op_end_date, visit_occurrence_id +INTO #qualified_events +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria + select pe.event_id, pe.person_id, pe.start_date, pe.end_date, pe.op_start_date, pe.op_end_date, row_number() over (partition by pe.person_id order by pe.start_date ASC) as ordinal, cast(pe.visit_occurrence_id as bigint) as visit_occurrence_id + FROM primary_events pe + +) QE -) PE -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C +; -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C +--- Inclusion Rule Inserts -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date +select 0 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_0 FROM ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria - -) PE + select pe.person_id, pe.event_id + FROM #qualified_events pe + JOIN ( -- Begin Criteria Group select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E + FROM #qualified_events E INNER JOIN ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Observation Criteria -select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, - C.visit_occurrence_id, C.observation_date as sort_date -from -( - select o.* - FROM @cdm_database_schema.OBSERVATION o -JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 12) -) C - - --- End Observation Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria + -- Begin Demographic Criteria +SELECT 0 as index_id, e.person_id, e.event_id +FROM #qualified_events E +JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID +WHERE P.gender_concept_id in (8507) +GROUP BY e.person_id, e.event_id +-- End Demographic Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id HAVING COUNT(index_id) = 1 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; -UNION ALL +select 1 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_1 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( -- Begin Criteria Group -select 1 as index_id, person_id, event_id +select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E + FROM #qualified_events E INNER JOIN ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria + -- Begin Demographic Criteria +SELECT 0 as index_id, e.person_id, e.event_id +FROM #qualified_events E +JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID +WHERE YEAR(E.start_date) - P.year_of_birth >= 18 +GROUP BY e.person_id, e.event_id +-- End Demographic Criteria -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +select 2 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_2 +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P + select pe.person_id, pe.event_id + FROM #qualified_events pe + JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -1393,7 +994,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 18) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) ) C @@ -1406,26 +1007,11 @@ HAVING COUNT(cc.event_id) = 0 UNION ALL -- Begin Correlated Criteria -select 4 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -1435,39 +1021,24 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 5 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +select 2 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -1477,39 +1048,24 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +select 3 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -1519,54 +1075,144 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 + HAVING COUNT(index_id) = 4 ) G -- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; + +select 3 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_3 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM +( + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 10) +) C + + +-- End Condition Occurrence Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria + +UNION ALL +-- Begin Correlated Criteria +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date +from +( + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 10) +) C + + +-- End Observation Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id HAVING COUNT(index_id) = 2 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, cc.person_id, cc.event_id +select 4 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_4 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM #qualified_events P JOIN ( select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) PE JOIN ( @@ -1576,18 +1222,18 @@ FROM ( select E.person_id, E.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -1598,18 +1244,18 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -1694,20 +1340,20 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Observation Criteria -select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, - C.visit_occurrence_id, C.observation_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select o.* - FROM @cdm_database_schema.OBSERVATION o -JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 12) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 18) ) C --- End Observation Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_START_DATE ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria @@ -1719,39 +1365,52 @@ HAVING COUNT(cc.event_id) = 0 -- End Criteria Group ) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) >= 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL --- Begin Criteria Group -select 1 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria +-- Begin Correlated Criteria +select 1 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C -WHERE C.ordinal = 1 +WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) +AND C.ordinal = 1 -- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date + +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date @@ -1759,17 +1418,21 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C -WHERE C.ordinal = 1 +WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) +AND C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, @@ -1778,110 +1441,72 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C -WHERE C.ordinal = 1 +WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) +AND C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C +WHERE C.ordinal = 1 +-- End Condition Occurrence Criteria --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 18) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, p.person_id, p.event_id from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -1889,47 +1514,73 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id LEFT JOIN ( SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 18) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) >= 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria +select 2 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date from @@ -1941,13 +1592,15 @@ JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id WHERE C.ordinal = 1 -- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date + +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date @@ -1963,30 +1616,11 @@ WHERE C.ordinal = 1 ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 4 as index_id, cc.person_id, cc.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria @@ -2006,116 +1640,118 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C +WHERE C.ordinal = 1 +-- End Condition Occurrence Criteria --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 5 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM +( + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, p.person_id, p.event_id +from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id +WHERE C.ordinal = 1 +-- End Condition Occurrence Criteria +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date +) p +LEFT JOIN ( +SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 18) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 + HAVING COUNT(index_id) = 1 ) G -- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 2 + HAVING COUNT(index_id) >= 1 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id @@ -2127,63 +1763,13 @@ HAVING COUNT(cc.event_id) >= 1 ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) > 0 -) G --- End Criteria Group - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) >= 1 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; - -select 3 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_3 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from #qualified_events p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - -- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 10) -) C - - --- End Condition Occurrence Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) > 0 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id @@ -2198,7 +1784,9 @@ select inclusion_rule_id, person_id, event_id from #Inclusion_1 UNION ALL select inclusion_rule_id, person_id, event_id from #Inclusion_2 UNION ALL -select inclusion_rule_id, person_id, event_id from #Inclusion_3) I; +select inclusion_rule_id, person_id, event_id from #Inclusion_3 +UNION ALL +select inclusion_rule_id, person_id, event_id from #Inclusion_4) I; TRUNCATE TABLE #Inclusion_0; DROP TABLE #Inclusion_0; @@ -2211,6 +1799,9 @@ DROP TABLE #Inclusion_2; TRUNCATE TABLE #Inclusion_3; DROP TABLE #Inclusion_3; +TRUNCATE TABLE #Inclusion_4; +DROP TABLE #Inclusion_4; + with cteIncludedEvents(event_id, person_id, start_date, end_date, op_start_date, op_end_date, ordinal) as ( @@ -2224,13 +1815,13 @@ with cteIncludedEvents(event_id, person_id, start_date, end_date, op_start_date, ) MG -- matching groups -- the matching group with all bits set ( POWER(2,# of inclusion rules) - 1 = inclusion_rule_mask - WHERE (MG.inclusion_rule_mask = POWER(cast(2 as bigint),4)-1) + WHERE (MG.inclusion_rule_mask = POWER(cast(2 as bigint),5)-1) ) select event_id, person_id, start_date, end_date, op_start_date, op_end_date into #included_events FROM cteIncludedEvents Results -WHERE Results.ordinal = 1 + ; diff --git a/inst/sql/sql_server/115.sql b/inst/sql/sql_server/115.sql index 0cd1ddb..c11792e 100644 --- a/inst/sql/sql_server/115.sql +++ b/inst/sql/sql_server/115.sql @@ -7,7 +7,7 @@ CREATE TABLE #Codesets ( INSERT INTO #Codesets (codeset_id, concept_id) SELECT 1 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930,4264861,4264288,4246703,763131) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id @@ -40,22 +40,17 @@ WHERE E.concept_id is null ) C UNION ALL SELECT 4 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4304921,4145907,4341536) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4304921,4304921,4073142,4073143,4341536,4012324,4073141,4071936,4341536,4145907) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (4304921,4145907,4341536) + and ca.ancestor_concept_id in (4304921,4304921,4073142,4073143,4341536,4012324,4073141,4071936,4341536,4145907) and c.invalid_reason is null ) I LEFT JOIN ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (35608156,35624545,35624534,35624540,35624546,35624535,35624541,35624539,4021070,2780498,2780499,2780496,2780497,2780494,2780495,35624537,35624542,4012324) -UNION select c.concept_id - from @vocabulary_database_schema.CONCEPT c - join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (4012324) - and c.invalid_reason is null + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (35608156,35624545,35624534,35624540,35624546,35624535,35624541,35624539,4021070,2780498,2780499,2780496,2780497,2780494,2780495,35624537,35624542) ) E ON I.concept_id = E.concept_id WHERE E.concept_id is null @@ -71,7 +66,7 @@ UNION select c.concept_id ) I ) C UNION ALL -SELECT 9 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM +SELECT 7 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (3006575) UNION select c.concept_id @@ -82,129 +77,140 @@ UNION select c.concept_id ) I ) C UNION ALL -SELECT 11 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM +SELECT 10 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392,4312326) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533) + and ca.ancestor_concept_id in (443392,4312326) and c.invalid_reason is null ) I LEFT JOIN ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (2108677,4216658,4306299,4338661,3187777,40487861,4176312,4193061,2777698,2777697,2777700,2777699,2777702,2777701,2777704,2777703,2777706,2777705,44783041,4239543,2003966,4021570,2780477,2780478,2780479,2780480,4341384,4341893,4212360,4147673,4078386,4073700,4234536,4287859,44783043,4071791,4054558) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4112752,4111921,764971,36716186,200962,36712762,37395835,4164017,4141960,4163261,4183913,4283614,4289246,4283740,4280897,4289379) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (2108677,4306299,4338661,3187777,40487861,4176312,4193061,2777698,2777697,2777700,2777699,2777702,2777701,2777704,2777703,2777706,2777705,44783041,4239543,2003966,4021570,2780477,2780478,2780479,2780480,4341384,4341893,4212360,4147673,4078386,4073700,4234536,4287859,44783043,4071791,4054558) + and ca.ancestor_concept_id in (432851,4112752,4111921,764971,36716186,200962,36712762,37395835,4164017,4141960,4163261,4183913,4283614,4289246,4283740,4280897,4289379) and c.invalid_reason is null ) E ON I.concept_id = E.concept_id WHERE E.concept_id is null ) C UNION ALL -SELECT 12 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM +SELECT 11 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (19058410,739471,35834903,1343039,19089810,1366310,1351541,1344381,19010792,1356461,1500211,1300978,1315286,35807385,35807349) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (443392) + and ca.ancestor_concept_id in (19058410,739471,35834903,1343039,19089810,1366310,1351541,1344381,19010792,1356461,1500211,1300978,1315286,35807385,35807349) and c.invalid_reason is null ) I -LEFT JOIN -( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4112752,4111921,764971,36716186,200962,36712762,37395835,4164017,4141960,4163261,4183913,4283614,4289246,4283740,4280897,4289379) +) C UNION ALL +SELECT 12 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM +( + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (40239056,963987,42900250,1361291) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (432851,4112752,4111921,764971,36716186,200962,36712762,37395835,4164017,4141960,4163261,4183913,4283614,4289246,4283740,4280897,4289379) + and ca.ancestor_concept_id in (40239056,963987,42900250,1361291) and c.invalid_reason is null -) E ON I.concept_id = E.concept_id -WHERE E.concept_id is null +) I ) C UNION ALL SELECT 13 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (19058410,739471,35834903,1343039,19089810,1366310,1351541,1344381,19010792,1356461,1500211,1300978,1315286,35807385,35807349) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (1315942,40222431,1378382) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (19058410,739471,35834903,1343039,19089810,1366310,1351541,1344381,19010792,1356461,1500211,1300978,1315286,35807385,35807349) + and ca.ancestor_concept_id in (1315942,40222431,1378382) and c.invalid_reason is null ) I ) C UNION ALL SELECT 14 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (40239056,963987,42900250,1361291) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (44816340) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (40239056,963987,42900250,1361291) + and ca.ancestor_concept_id in (44816340) and c.invalid_reason is null ) I ) C UNION ALL SELECT 15 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (1315942,40222431,1378382) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (45892579,1718850) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (1315942,40222431,1378382) + and ca.ancestor_concept_id in (45892579,1718850) and c.invalid_reason is null ) I ) C UNION ALL SELECT 16 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (44816340) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (44816340) + and ca.ancestor_concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) and c.invalid_reason is null ) I ) C UNION ALL SELECT 17 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (45892579,1718850) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (45775578,902727,43526934) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (45892579,1718850) + and ca.ancestor_concept_id in (45775578,902727,43526934) and c.invalid_reason is null ) I +LEFT JOIN +( + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (41267222) + +) E ON I.concept_id = E.concept_id +WHERE E.concept_id is null ) C UNION ALL SELECT 18 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (3169330,4180749) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) + and ca.ancestor_concept_id in (3169330,4180749) and c.invalid_reason is null ) I ) C UNION ALL SELECT 19 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (45775578,902727,43526934) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533,2110046,2110035,2108678,2101059,2777698,40490346,2110043,2789830,709928,42733763,42733764) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (45775578,902727,43526934) + and ca.ancestor_concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533,2110046,2110035,2108678) and c.invalid_reason is null ) I LEFT JOIN ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (41267222) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (2108677,4216658,4306299,4338661,3187777,40487861,4176312,4193061,2777698,2777697,2777700,2777699,2777702,2777701,2777704,2777703,2777706,2777705,44783041,4239543,2003966,4021570,2780477,2780478,2780479,2780480,4341384,4341893,4212360,4147673,4078386,4073700,4234536,4287859,44783043,4071791,4054558) +UNION select c.concept_id + from @vocabulary_database_schema.CONCEPT c + join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id + and ca.ancestor_concept_id in (2108677,4306299,4338661,3187777,40487861,4176312,4193061,2777698,2777697,2777700,2777699,2777702,2777701,2777704,2777703,2777706,2777705,44783041,4239543,2003966,4021570,2780477,2780478,2780479,2780480,4341384,4341893,4212360,4147673,4078386,4073700,4234536,4287859,44783043,4071791,4054558) + and c.invalid_reason is null ) E ON I.concept_id = E.concept_id WHERE E.concept_id is null @@ -230,7 +236,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) @@ -242,20 +248,19 @@ select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as s C.visit_occurrence_id, C.procedure_date as sort_date from ( - select po.* , row_number() over (PARTITION BY po.person_id ORDER BY po.procedure_date, po.procedure_occurrence_id) as ordinal + select po.* FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) -AND C.ordinal = 1 -- End Procedure Occurrence Criteria ) E JOIN @cdm_database_schema.observation_period OP on E.person_id = OP.person_id and E.start_date >= OP.observation_period_start_date and E.start_date <= op.observation_period_end_date WHERE DATEADD(day,183,OP.OBSERVATION_PERIOD_START_DATE) <= E.START_DATE AND DATEADD(day,0,E.START_DATE) <= OP.OBSERVATION_PERIOD_END_DATE ) P - +WHERE P.ordinal = 1 -- End Primary Events ) @@ -349,224 +354,152 @@ JOIN ( -- Begin Criteria Group select 0 as index_id, person_id, event_id FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM ( select E.person_id, E.event_id FROM #qualified_events E INNER JOIN ( -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id +select 0 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id FROM #qualified_events P JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria - -) PE -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C +-- End Drug Exposure Criteria -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +UNION ALL +-- Begin Correlated Criteria +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( - -- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) ) C --- End Condition Occurrence Criteria +-- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +select 2 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( - -- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) ) C --- End Procedure Occurrence Criteria +-- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +select 3 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p + +-- End Drug Exposure Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria + +UNION ALL +-- Begin Correlated Criteria +select 4 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM #qualified_events P +JOIN ( + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P + +-- End Drug Exposure Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria + +UNION ALL +-- Begin Correlated Criteria +select 5 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -576,108 +509,74 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 3 + HAVING COUNT(index_id) = 6 ) G -- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; -UNION ALL +select 3 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_3 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( -- Begin Criteria Group -select 1 as index_id, person_id, event_id +select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E + FROM #qualified_events E INNER JOIN ( -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria +select 0 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + -- Begin Condition Occurrence Criteria SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, C.visit_occurrence_id, C.condition_start_date as sort_date FROM ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + SELECT co.* FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date -from -( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 11) + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 10) ) C --- End Procedure Occurrence Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( -- Begin Observation Criteria select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, @@ -686,31 +585,57 @@ from ( select o.* FROM @cdm_database_schema.OBSERVATION o -JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 11) +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 10) ) C -- End Observation Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) > 0 + HAVING COUNT(index_id) = 2 ) G -- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; -UNION ALL +select 4 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_4 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( -- Begin Criteria Group -select 2 as index_id, person_id, event_id +select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria + FROM #qualified_events E + INNER JOIN + ( + -- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Condition Occurrence Criteria SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, C.visit_occurrence_id, C.condition_start_date as sort_date FROM @@ -722,15 +647,15 @@ FROM WHERE C.ordinal = 1 -- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date + +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Condition Occurrence Criteria SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, C.visit_occurrence_id, C.condition_start_date as sort_date @@ -746,9 +671,12 @@ WHERE C.ordinal = 1 ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Condition Occurrence Criteria SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, @@ -767,23 +695,22 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL @@ -834,13 +761,13 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria @@ -885,1001 +812,137 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 18) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 19) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 -) G --- End Criteria Group - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 3 -) G --- End Criteria Group -) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria - -) PE -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - - --- End Condition Occurrence Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date -from -( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) -) C - - --- End Procedure Occurrence Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Criteria Group -select 3 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Observation Criteria -select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, - C.visit_occurrence_id, C.observation_date as sort_date -from -( - select o.* - FROM @cdm_database_schema.OBSERVATION o -JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 11) -) C - - --- End Observation Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date -from -( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 11) -) C - - --- End Procedure Occurrence Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) > 0 -) G --- End Criteria Group - -UNION ALL --- Begin Criteria Group -select 4 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 18) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +-- End Correlated Criteria + +UNION ALL +-- Begin Criteria Group +select 3 as index_id, person_id, event_id +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM +( + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 19) + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 19) ) C --- End Drug Exposure Criteria +-- End Observation Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id +select 1 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 19) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 + HAVING COUNT(index_id) > 0 ) G -- End Criteria Group ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 5 + HAVING COUNT(index_id) = 4 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id @@ -1891,7 +954,7 @@ HAVING COUNT(cc.event_id) >= 1 UNION ALL -- Begin Correlated Criteria -select 2 as index_id, cc.person_id, cc.event_id +select 1 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM #qualified_events P JOIN ( @@ -1903,7 +966,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -1925,7 +988,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -1948,7 +1011,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -1972,7 +1035,7 @@ FROM -- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria @@ -1988,7 +1051,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -2008,7 +1071,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -2019,18 +1082,19 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C --- End Procedure Occurrence Criteria +-- End Drug Exposure Criteria ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id @@ -2048,7 +1112,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -2068,7 +1132,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -2079,21 +1143,20 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria @@ -2112,7 +1175,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -2135,7 +1198,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -2146,18 +1209,18 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date from ( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 11) + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 19) ) C --- End Procedure Occurrence Criteria +-- End Observation Criteria ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id @@ -2176,7 +1239,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -2187,18 +1250,18 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Observation Criteria -select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, - C.visit_occurrence_id, C.observation_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select o.* - FROM @cdm_database_schema.OBSERVATION o -JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 11) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 19) ) C --- End Observation Criteria +-- End Procedure Occurrence Criteria ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id @@ -2211,157 +1274,46 @@ HAVING COUNT(cc.event_id) >= 1 ) G -- End Criteria Group -UNION ALL --- Begin Criteria Group -select 4 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) -) C - - --- End Drug Exposure Criteria + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 4 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria +UNION ALL +-- Begin Correlated Criteria +select 2 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P + +) PE JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date @@ -2369,18 +1321,20 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, @@ -2389,39 +1343,37 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 18) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id +select 1 as index_id, p.person_id, p.event_id from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, @@ -2430,11 +1382,10 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id @@ -2450,11 +1401,10 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id @@ -2469,20 +1419,20 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id +select 2 as index_id, p.person_id, p.event_id from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, @@ -2491,11 +1441,10 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id @@ -2511,40 +1460,41 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL --- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +-- Begin Criteria Group +select 3 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date @@ -2552,18 +1502,20 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, @@ -2572,39 +1524,37 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 19) + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 19) ) C --- End Drug Exposure Criteria +-- End Observation Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id +select 1 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria @@ -2614,45 +1564,43 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 19) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 + HAVING COUNT(index_id) > 0 ) G -- End Criteria Group ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 5 + HAVING COUNT(index_id) = 4 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id @@ -2664,63 +1612,13 @@ HAVING COUNT(cc.event_id) >= 1 ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) > 0 -) G --- End Criteria Group - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) >= 1 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; - -select 3 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_3 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from #qualified_events p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - -- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 12) -) C - - --- End Condition Occurrence Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) > 0 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id @@ -2735,7 +1633,9 @@ select inclusion_rule_id, person_id, event_id from #Inclusion_1 UNION ALL select inclusion_rule_id, person_id, event_id from #Inclusion_2 UNION ALL -select inclusion_rule_id, person_id, event_id from #Inclusion_3) I; +select inclusion_rule_id, person_id, event_id from #Inclusion_3 +UNION ALL +select inclusion_rule_id, person_id, event_id from #Inclusion_4) I; TRUNCATE TABLE #Inclusion_0; DROP TABLE #Inclusion_0; @@ -2748,6 +1648,9 @@ DROP TABLE #Inclusion_2; TRUNCATE TABLE #Inclusion_3; DROP TABLE #Inclusion_3; +TRUNCATE TABLE #Inclusion_4; +DROP TABLE #Inclusion_4; + with cteIncludedEvents(event_id, person_id, start_date, end_date, op_start_date, op_end_date, ordinal) as ( @@ -2761,13 +1664,13 @@ with cteIncludedEvents(event_id, person_id, start_date, end_date, op_start_date, ) MG -- matching groups -- the matching group with all bits set ( POWER(2,# of inclusion rules) - 1 = inclusion_rule_mask - WHERE (MG.inclusion_rule_mask = POWER(cast(2 as bigint),4)-1) + WHERE (MG.inclusion_rule_mask = POWER(cast(2 as bigint),5)-1) ) select event_id, person_id, start_date, end_date, op_start_date, op_end_date into #included_events FROM cteIncludedEvents Results -WHERE Results.ordinal = 1 + ; @@ -2791,7 +1694,7 @@ FROM ( SELECT co.* FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 12) + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 10) ) C diff --git a/inst/sql/sql_server/116.sql b/inst/sql/sql_server/116.sql index 773871e..5fe82f1 100644 --- a/inst/sql/sql_server/116.sql +++ b/inst/sql/sql_server/116.sql @@ -7,7 +7,7 @@ CREATE TABLE #Codesets ( INSERT INTO #Codesets (codeset_id, concept_id) SELECT 1 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930,4264861,4264288,4246703,763131) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id @@ -40,22 +40,17 @@ WHERE E.concept_id is null ) C UNION ALL SELECT 4 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4304921,4145907,4341536) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4304921,4304921,4073142,4073143,4341536,4012324,4073141,4071936,4341536,4145907) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (4304921,4145907,4341536) + and ca.ancestor_concept_id in (4304921,4304921,4073142,4073143,4341536,4012324,4073141,4071936,4341536,4145907) and c.invalid_reason is null ) I LEFT JOIN ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (35608156,35624545,35624534,35624540,35624546,35624535,35624541,35624539,4021070,2780498,2780499,2780496,2780497,2780494,2780495,35624537,35624542,4012324) -UNION select c.concept_id - from @vocabulary_database_schema.CONCEPT c - join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (4012324) - and c.invalid_reason is null + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (35608156,35624545,35624534,35624540,35624546,35624535,35624541,35624539,4021070,2780498,2780499,2780496,2780497,2780494,2780495,35624537,35624542) ) E ON I.concept_id = E.concept_id WHERE E.concept_id is null @@ -71,7 +66,7 @@ UNION select c.concept_id ) I ) C UNION ALL -SELECT 9 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM +SELECT 7 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (3006575) UNION select c.concept_id @@ -82,129 +77,140 @@ UNION select c.concept_id ) I ) C UNION ALL -SELECT 11 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM +SELECT 10 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392,4312326) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533) + and ca.ancestor_concept_id in (443392,4312326) and c.invalid_reason is null ) I LEFT JOIN ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (2108677,4216658,4306299,4338661,3187777,40487861,4176312,4193061,2777698,2777697,2777700,2777699,2777702,2777701,2777704,2777703,2777706,2777705,44783041,4239543,2003966,4021570,2780477,2780478,2780479,2780480,4341384,4341893,4212360,4147673,4078386,4073700,4234536,4287859,44783043,4071791,4054558) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4112752,4111921,764971,36716186,200962,36712762,37395835,4164017,4141960,4163261,4183913,4283614,4289246,4283740,4280897,4289379) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (2108677,4306299,4338661,3187777,40487861,4176312,4193061,2777698,2777697,2777700,2777699,2777702,2777701,2777704,2777703,2777706,2777705,44783041,4239543,2003966,4021570,2780477,2780478,2780479,2780480,4341384,4341893,4212360,4147673,4078386,4073700,4234536,4287859,44783043,4071791,4054558) + and ca.ancestor_concept_id in (432851,4112752,4111921,764971,36716186,200962,36712762,37395835,4164017,4141960,4163261,4183913,4283614,4289246,4283740,4280897,4289379) and c.invalid_reason is null ) E ON I.concept_id = E.concept_id WHERE E.concept_id is null ) C UNION ALL -SELECT 12 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM +SELECT 11 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (19058410,739471,35834903,1343039,19089810,1366310,1351541,1344381,19010792,1356461,1500211,1300978,1315286,35807385,35807349) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (443392) + and ca.ancestor_concept_id in (19058410,739471,35834903,1343039,19089810,1366310,1351541,1344381,19010792,1356461,1500211,1300978,1315286,35807385,35807349) and c.invalid_reason is null ) I -LEFT JOIN -( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4112752,4111921,764971,36716186,200962,36712762,37395835,4164017,4141960,4163261,4183913,4283614,4289246,4283740,4280897,4289379) +) C UNION ALL +SELECT 12 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM +( + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (40239056,963987,42900250,1361291) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (432851,4112752,4111921,764971,36716186,200962,36712762,37395835,4164017,4141960,4163261,4183913,4283614,4289246,4283740,4280897,4289379) + and ca.ancestor_concept_id in (40239056,963987,42900250,1361291) and c.invalid_reason is null -) E ON I.concept_id = E.concept_id -WHERE E.concept_id is null +) I ) C UNION ALL SELECT 13 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (19058410,739471,35834903,1343039,19089810,1366310,1351541,1344381,19010792,1356461,1500211,1300978,1315286,35807385,35807349) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (1315942,40222431,1378382) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (19058410,739471,35834903,1343039,19089810,1366310,1351541,1344381,19010792,1356461,1500211,1300978,1315286,35807385,35807349) + and ca.ancestor_concept_id in (1315942,40222431,1378382) and c.invalid_reason is null ) I ) C UNION ALL SELECT 14 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (40239056,963987,42900250,1361291) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (44816340) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (40239056,963987,42900250,1361291) + and ca.ancestor_concept_id in (44816340) and c.invalid_reason is null ) I ) C UNION ALL SELECT 15 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (1315942,40222431,1378382) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (45892579,1718850) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (1315942,40222431,1378382) + and ca.ancestor_concept_id in (45892579,1718850) and c.invalid_reason is null ) I ) C UNION ALL SELECT 16 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (44816340) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (44816340) + and ca.ancestor_concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) and c.invalid_reason is null ) I ) C UNION ALL SELECT 17 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (45892579,1718850) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (45775578,902727,43526934) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (45892579,1718850) + and ca.ancestor_concept_id in (45775578,902727,43526934) and c.invalid_reason is null ) I +LEFT JOIN +( + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (41267222) + +) E ON I.concept_id = E.concept_id +WHERE E.concept_id is null ) C UNION ALL SELECT 18 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (3169330,4180749) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) + and ca.ancestor_concept_id in (3169330,4180749) and c.invalid_reason is null ) I ) C UNION ALL SELECT 19 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (45775578,902727,43526934) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533,2110046,2110035,2108678,2101059,2777698,40490346,2110043,2789830,709928,42733763,42733764) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (45775578,902727,43526934) + and ca.ancestor_concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533,2110046,2110035,2108678) and c.invalid_reason is null ) I LEFT JOIN ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (41267222) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (2108677,4216658,4306299,4338661,3187777,40487861,4176312,4193061,2777698,2777697,2777700,2777699,2777702,2777701,2777704,2777703,2777706,2777705,44783041,4239543,2003966,4021570,2780477,2780478,2780479,2780480,4341384,4341893,4212360,4147673,4078386,4073700,4234536,4287859,44783043,4071791,4054558) +UNION select c.concept_id + from @vocabulary_database_schema.CONCEPT c + join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id + and ca.ancestor_concept_id in (2108677,4306299,4338661,3187777,40487861,4176312,4193061,2777698,2777697,2777700,2777699,2777702,2777701,2777704,2777703,2777706,2777705,44783041,4239543,2003966,4021570,2780477,2780478,2780479,2780480,4341384,4341893,4212360,4147673,4078386,4073700,4234536,4287859,44783043,4071791,4054558) + and c.invalid_reason is null ) E ON I.concept_id = E.concept_id WHERE E.concept_id is null @@ -222,7 +228,8 @@ FROM OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date, cast(E.visit_occurrence_id as bigint) as visit_occurrence_id FROM ( - -- Begin Drug Exposure Criteria + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -230,29 +237,44 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria -UNION ALL --- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select po.* , row_number() over (PARTITION BY po.person_id ORDER BY po.procedure_date, po.procedure_occurrence_id) as ordinal - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C -WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) -AND C.ordinal = 1 --- End Procedure Occurrence Criteria - -UNION ALL --- Begin Drug Exposure Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -260,186 +282,167 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria - - ) E - JOIN @cdm_database_schema.observation_period OP on E.person_id = OP.person_id and E.start_date >= OP.observation_period_start_date and E.start_date <= op.observation_period_end_date - WHERE DATEADD(day,183,OP.OBSERVATION_PERIOD_START_DATE) <= E.START_DATE AND DATEADD(day,0,E.START_DATE) <= OP.OBSERVATION_PERIOD_END_DATE +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P - --- End Primary Events - -) -SELECT event_id, person_id, start_date, end_date, op_start_date, op_end_date, visit_occurrence_id -INTO #qualified_events -FROM +JOIN ( + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - select pe.event_id, pe.person_id, pe.start_date, pe.end_date, pe.op_start_date, pe.op_end_date, row_number() over (partition by pe.person_id order by pe.start_date ASC) as ordinal, cast(pe.visit_occurrence_id as bigint) as visit_occurrence_id - FROM primary_events pe - -) QE + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) +) C -; ---- Inclusion Rule Inserts +-- End Drug Exposure Criteria -select 0 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_0 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Demographic Criteria -SELECT 0 as index_id, e.person_id, e.event_id -FROM #qualified_events E -JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID -WHERE P.gender_concept_id in (8507) -GROUP BY e.person_id, e.event_id --- End Demographic Criteria +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id HAVING COUNT(index_id) = 1 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id -select 1 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_1 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM +UNION ALL +select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Demographic Criteria -SELECT 0 as index_id, e.person_id, e.event_id -FROM #qualified_events E -JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID -WHERE YEAR(E.start_date) - P.year_of_birth >= 18 -GROUP BY e.person_id, e.event_id --- End Demographic Criteria + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) +) C - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 -) G --- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria -select 2 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_2 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - +) PE JOIN ( -- Begin Criteria Group select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - select E.person_id, E.event_id - FROM #qualified_events E + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) +) C + +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date +) E INNER JOIN ( -- Begin Correlated Criteria select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria - -) PE +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date +) P JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) +) C + + +-- End Drug Exposure Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + +UNION ALL +select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Criteria Group +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria + +) PE +JOIN ( +-- Begin Criteria Group select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -450,76 +453,61 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C --- End Condition Occurrence Criteria +-- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +select 1 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -538,787 +526,154 @@ JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id -- End Procedure Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 3 + HAVING COUNT(index_id) > 0 ) G -- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id -UNION ALL --- Begin Criteria Group -select 1 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date + ) E + JOIN @cdm_database_schema.observation_period OP on E.person_id = OP.person_id and E.start_date >= OP.observation_period_start_date and E.start_date <= op.observation_period_end_date + WHERE DATEADD(day,183,OP.OBSERVATION_PERIOD_START_DATE) <= E.START_DATE AND DATEADD(day,0,E.START_DATE) <= OP.OBSERVATION_PERIOD_END_DATE +) P +WHERE P.ordinal = 1 +-- End Primary Events + +) +SELECT event_id, person_id, start_date, end_date, op_start_date, op_end_date, visit_occurrence_id +INTO #qualified_events FROM ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C + select pe.event_id, pe.person_id, pe.start_date, pe.end_date, pe.op_start_date, pe.op_end_date, row_number() over (partition by pe.person_id order by pe.start_date ASC) as ordinal, cast(pe.visit_occurrence_id as bigint) as visit_occurrence_id + FROM primary_events pe + +) QE -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date -from -( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 11) -) C - - --- End Procedure Occurrence Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Observation Criteria -select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, - C.visit_occurrence_id, C.observation_date as sort_date -from -( - select o.* - FROM @cdm_database_schema.OBSERVATION o -JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 11) -) C - - --- End Observation Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) > 0 -) G --- End Criteria Group - -UNION ALL --- Begin Criteria Group -select 2 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 18) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 19) -) C - - --- End Drug Exposure Criteria +; -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria +--- Inclusion Rule Inserts -UNION ALL --- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date +select 0 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_0 FROM ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P + select pe.person_id, pe.event_id + FROM #qualified_events pe + JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Demographic Criteria +SELECT 0 as index_id, e.person_id, e.event_id +FROM #qualified_events E +JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID +WHERE P.gender_concept_id in (8507) +GROUP BY e.person_id, e.event_id +-- End Demographic Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 + HAVING COUNT(index_id) = 1 ) G -- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; + +select 1 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_1 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Demographic Criteria +SELECT 0 as index_id, e.person_id, e.event_id +FROM #qualified_events E +JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID +WHERE YEAR(E.start_date) - P.year_of_birth >= 18 +GROUP BY e.person_id, e.event_id +-- End Demographic Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 3 + HAVING COUNT(index_id) = 1 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +select 2 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_2 +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria - -) PE + select pe.person_id, pe.event_id + FROM #qualified_events pe + JOIN ( -- Begin Criteria Group select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E + FROM #qualified_events E INNER JOIN ( -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - - --- End Condition Occurrence Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +select 0 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date +FROM #qualified_events P +JOIN ( + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) ) C --- End Procedure Occurrence Criteria +-- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -1328,326 +683,307 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL --- Begin Criteria Group -select 3 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date +-- Begin Correlated Criteria +select 2 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) ) C -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +-- End Drug Exposure Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria + +UNION ALL +-- Begin Correlated Criteria +select 3 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( - -- Begin Observation Criteria -select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, - C.visit_occurrence_id, C.observation_date as sort_date + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select o.* - FROM @cdm_database_schema.OBSERVATION o -JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 11) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) ) C --- End Observation Criteria +-- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +select 4 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( - -- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 11) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C --- End Procedure Occurrence Criteria +-- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) > 0 + HAVING COUNT(index_id) = 5 ) G -- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; -UNION ALL +select 3 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_3 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( -- Begin Criteria Group -select 4 as index_id, person_id, event_id +select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E + FROM #qualified_events E INNER JOIN ( -- Begin Correlated Criteria select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 10) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 10) ) C --- End Drug Exposure Criteria +-- End Observation Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 2 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; + +select 4 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_4 +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM +( + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria + +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM +( + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) +) C + +WHERE C.ordinal = 1 +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 18) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id +select 1 as index_id, p.person_id, p.event_id from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -1655,18 +991,18 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id LEFT JOIN ( SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -1680,33 +1016,33 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id +select 2 as index_id, p.person_id, p.event_id from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -1714,151 +1050,154 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id LEFT JOIN ( SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL --- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +-- Begin Criteria Group +select 3 as index_id, person_id, event_id +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM +( + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 19) + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 19) ) C --- End Drug Exposure Criteria +-- End Observation Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id +select 1 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 19) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 + HAVING COUNT(index_id) > 0 ) G -- End Criteria Group ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 5 + HAVING COUNT(index_id) = 4 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id @@ -1870,7 +1209,7 @@ HAVING COUNT(cc.event_id) >= 1 UNION ALL -- Begin Correlated Criteria -select 2 as index_id, cc.person_id, cc.event_id +select 1 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM #qualified_events P JOIN ( @@ -1882,7 +1221,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -1904,7 +1243,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -1927,7 +1266,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -1951,7 +1290,7 @@ FROM -- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria @@ -1967,7 +1306,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -1987,7 +1326,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -1998,18 +1337,19 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C --- End Procedure Occurrence Criteria +-- End Drug Exposure Criteria ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id @@ -2027,7 +1367,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -2047,7 +1387,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -2058,21 +1398,20 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria @@ -2091,7 +1430,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -2114,7 +1453,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -2125,18 +1464,18 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date from ( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 11) + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 19) ) C --- End Procedure Occurrence Criteria +-- End Observation Criteria ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id @@ -2155,7 +1494,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -2166,18 +1505,18 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Observation Criteria -select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, - C.visit_occurrence_id, C.observation_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select o.* - FROM @cdm_database_schema.OBSERVATION o -JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 11) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 19) ) C --- End Observation Criteria +-- End Procedure Occurrence Criteria ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id @@ -2190,138 +1529,46 @@ HAVING COUNT(cc.event_id) >= 1 ) G -- End Criteria Group -UNION ALL --- Begin Criteria Group -select 4 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) -) C - - --- End Drug Exposure Criteria + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 4 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id +select 2 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria +FROM #qualified_events P +JOIN ( + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P + +) PE JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date @@ -2329,18 +1576,20 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, @@ -2349,39 +1598,37 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 18) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id +select 1 as index_id, p.person_id, p.event_id from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, @@ -2390,11 +1637,10 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id @@ -2410,11 +1656,10 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id @@ -2429,20 +1674,20 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id +select 2 as index_id, p.person_id, p.event_id from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, @@ -2451,11 +1696,10 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id @@ -2471,40 +1715,41 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL --- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +-- Begin Criteria Group +select 3 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date @@ -2512,18 +1757,20 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, @@ -2532,39 +1779,37 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 19) + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 19) ) C --- End Drug Exposure Criteria +-- End Observation Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id +select 1 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria @@ -2574,45 +1819,43 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 19) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 + HAVING COUNT(index_id) > 0 ) G -- End Criteria Group ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 5 + HAVING COUNT(index_id) = 4 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id @@ -2624,63 +1867,13 @@ HAVING COUNT(cc.event_id) >= 1 ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) > 0 -) G --- End Criteria Group - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) >= 1 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; - -select 3 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_3 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from #qualified_events p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - -- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 12) -) C - - --- End Condition Occurrence Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) > 0 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id @@ -2695,7 +1888,9 @@ select inclusion_rule_id, person_id, event_id from #Inclusion_1 UNION ALL select inclusion_rule_id, person_id, event_id from #Inclusion_2 UNION ALL -select inclusion_rule_id, person_id, event_id from #Inclusion_3) I; +select inclusion_rule_id, person_id, event_id from #Inclusion_3 +UNION ALL +select inclusion_rule_id, person_id, event_id from #Inclusion_4) I; TRUNCATE TABLE #Inclusion_0; DROP TABLE #Inclusion_0; @@ -2708,6 +1903,9 @@ DROP TABLE #Inclusion_2; TRUNCATE TABLE #Inclusion_3; DROP TABLE #Inclusion_3; +TRUNCATE TABLE #Inclusion_4; +DROP TABLE #Inclusion_4; + with cteIncludedEvents(event_id, person_id, start_date, end_date, op_start_date, op_end_date, ordinal) as ( @@ -2721,13 +1919,13 @@ with cteIncludedEvents(event_id, person_id, start_date, end_date, op_start_date, ) MG -- matching groups -- the matching group with all bits set ( POWER(2,# of inclusion rules) - 1 = inclusion_rule_mask - WHERE (MG.inclusion_rule_mask = POWER(cast(2 as bigint),4)-1) + WHERE (MG.inclusion_rule_mask = POWER(cast(2 as bigint),5)-1) ) select event_id, person_id, start_date, end_date, op_start_date, op_end_date into #included_events FROM cteIncludedEvents Results -WHERE Results.ordinal = 1 + ; @@ -2751,7 +1949,7 @@ FROM ( SELECT co.* FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 12) + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 10) ) C diff --git a/inst/sql/sql_server/117.sql b/inst/sql/sql_server/117.sql index e0cef75..7ad6724 100644 --- a/inst/sql/sql_server/117.sql +++ b/inst/sql/sql_server/117.sql @@ -7,7 +7,7 @@ CREATE TABLE #Codesets ( INSERT INTO #Codesets (codeset_id, concept_id) SELECT 1 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930,4264861,4264288,4246703,763131) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id @@ -40,22 +40,17 @@ WHERE E.concept_id is null ) C UNION ALL SELECT 4 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4304921,4145907,4341536) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4304921,4304921,4073142,4073143,4341536,4012324,4073141,4071936,4341536,4145907) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (4304921,4145907,4341536) + and ca.ancestor_concept_id in (4304921,4304921,4073142,4073143,4341536,4012324,4073141,4071936,4341536,4145907) and c.invalid_reason is null ) I LEFT JOIN ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (35608156,35624545,35624534,35624540,35624546,35624535,35624541,35624539,4021070,2780498,2780499,2780496,2780497,2780494,2780495,35624537,35624542,4012324) -UNION select c.concept_id - from @vocabulary_database_schema.CONCEPT c - join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (4012324) - and c.invalid_reason is null + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (35608156,35624545,35624534,35624540,35624546,35624535,35624541,35624539,4021070,2780498,2780499,2780496,2780497,2780494,2780495,35624537,35624542) ) E ON I.concept_id = E.concept_id WHERE E.concept_id is null @@ -71,7 +66,7 @@ UNION select c.concept_id ) I ) C UNION ALL -SELECT 9 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM +SELECT 7 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (3006575) UNION select c.concept_id @@ -82,129 +77,140 @@ UNION select c.concept_id ) I ) C UNION ALL -SELECT 11 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM +SELECT 10 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392,4312326) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533) + and ca.ancestor_concept_id in (443392,4312326) and c.invalid_reason is null ) I LEFT JOIN ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (2108677,4216658,4306299,4338661,3187777,40487861,4176312,4193061,2777698,2777697,2777700,2777699,2777702,2777701,2777704,2777703,2777706,2777705,44783041,4239543,2003966,4021570,2780477,2780478,2780479,2780480,4341384,4341893,4212360,4147673,4078386,4073700,4234536,4287859,44783043,4071791,4054558) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4112752,4111921,764971,36716186,200962,36712762,37395835,4164017,4141960,4163261,4183913,4283614,4289246,4283740,4280897,4289379) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (2108677,4306299,4338661,3187777,40487861,4176312,4193061,2777698,2777697,2777700,2777699,2777702,2777701,2777704,2777703,2777706,2777705,44783041,4239543,2003966,4021570,2780477,2780478,2780479,2780480,4341384,4341893,4212360,4147673,4078386,4073700,4234536,4287859,44783043,4071791,4054558) + and ca.ancestor_concept_id in (432851,4112752,4111921,764971,36716186,200962,36712762,37395835,4164017,4141960,4163261,4183913,4283614,4289246,4283740,4280897,4289379) and c.invalid_reason is null ) E ON I.concept_id = E.concept_id WHERE E.concept_id is null ) C UNION ALL -SELECT 12 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM +SELECT 11 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (19058410,739471,35834903,1343039,19089810,1366310,1351541,1344381,19010792,1356461,1500211,1300978,1315286,35807385,35807349) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (443392) + and ca.ancestor_concept_id in (19058410,739471,35834903,1343039,19089810,1366310,1351541,1344381,19010792,1356461,1500211,1300978,1315286,35807385,35807349) and c.invalid_reason is null ) I -LEFT JOIN -( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4112752,4111921,764971,36716186,200962,36712762,37395835,4164017,4141960,4163261,4183913,4283614,4289246,4283740,4280897,4289379) +) C UNION ALL +SELECT 12 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM +( + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (40239056,963987,42900250,1361291) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (432851,4112752,4111921,764971,36716186,200962,36712762,37395835,4164017,4141960,4163261,4183913,4283614,4289246,4283740,4280897,4289379) + and ca.ancestor_concept_id in (40239056,963987,42900250,1361291) and c.invalid_reason is null -) E ON I.concept_id = E.concept_id -WHERE E.concept_id is null +) I ) C UNION ALL SELECT 13 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (19058410,739471,35834903,1343039,19089810,1366310,1351541,1344381,19010792,1356461,1500211,1300978,1315286,35807385,35807349) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (1315942,40222431,1378382) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (19058410,739471,35834903,1343039,19089810,1366310,1351541,1344381,19010792,1356461,1500211,1300978,1315286,35807385,35807349) + and ca.ancestor_concept_id in (1315942,40222431,1378382) and c.invalid_reason is null ) I ) C UNION ALL SELECT 14 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (40239056,963987,42900250,1361291) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (44816340) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (40239056,963987,42900250,1361291) + and ca.ancestor_concept_id in (44816340) and c.invalid_reason is null ) I ) C UNION ALL SELECT 15 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (1315942,40222431,1378382) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (45892579,1718850) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (1315942,40222431,1378382) + and ca.ancestor_concept_id in (45892579,1718850) and c.invalid_reason is null ) I ) C UNION ALL SELECT 16 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (44816340) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (44816340) + and ca.ancestor_concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) and c.invalid_reason is null ) I ) C UNION ALL SELECT 17 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (45892579,1718850) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (45775578,902727,43526934) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (45892579,1718850) + and ca.ancestor_concept_id in (45775578,902727,43526934) and c.invalid_reason is null ) I +LEFT JOIN +( + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (41267222) + +) E ON I.concept_id = E.concept_id +WHERE E.concept_id is null ) C UNION ALL SELECT 18 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (3169330,4180749) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) + and ca.ancestor_concept_id in (3169330,4180749) and c.invalid_reason is null ) I ) C UNION ALL SELECT 19 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (45775578,902727,43526934) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533,2110046,2110035,2108678,2101059,2777698,40490346,2110043,2789830,709928,42733763,42733764) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (45775578,902727,43526934) + and ca.ancestor_concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533,2110046,2110035,2108678) and c.invalid_reason is null ) I LEFT JOIN ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (41267222) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (2108677,4216658,4306299,4338661,3187777,40487861,4176312,4193061,2777698,2777697,2777700,2777699,2777702,2777701,2777704,2777703,2777706,2777705,44783041,4239543,2003966,4021570,2780477,2780478,2780479,2780480,4341384,4341893,4212360,4147673,4078386,4073700,4234536,4287859,44783043,4071791,4054558) +UNION select c.concept_id + from @vocabulary_database_schema.CONCEPT c + join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id + and ca.ancestor_concept_id in (2108677,4306299,4338661,3187777,40487861,4176312,4193061,2777698,2777697,2777700,2777699,2777702,2777701,2777704,2777703,2777706,2777705,44783041,4239543,2003966,4021570,2780477,2780478,2780479,2780480,4341384,4341893,4212360,4147673,4078386,4073700,4234536,4287859,44783043,4071791,4054558) + and c.invalid_reason is null ) E ON I.concept_id = E.concept_id WHERE E.concept_id is null @@ -222,7 +228,8 @@ FROM OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date, cast(E.visit_occurrence_id as bigint) as visit_occurrence_id FROM ( - -- Begin Drug Exposure Criteria + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -230,29 +237,44 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria -UNION ALL --- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select po.* , row_number() over (PARTITION BY po.person_id ORDER BY po.procedure_date, po.procedure_occurrence_id) as ordinal - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C -WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) -AND C.ordinal = 1 --- End Procedure Occurrence Criteria - -UNION ALL --- Begin Drug Exposure Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -260,186 +282,167 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria - - ) E - JOIN @cdm_database_schema.observation_period OP on E.person_id = OP.person_id and E.start_date >= OP.observation_period_start_date and E.start_date <= op.observation_period_end_date - WHERE DATEADD(day,183,OP.OBSERVATION_PERIOD_START_DATE) <= E.START_DATE AND DATEADD(day,0,E.START_DATE) <= OP.OBSERVATION_PERIOD_END_DATE +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P - --- End Primary Events - -) -SELECT event_id, person_id, start_date, end_date, op_start_date, op_end_date, visit_occurrence_id -INTO #qualified_events -FROM +JOIN ( + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - select pe.event_id, pe.person_id, pe.start_date, pe.end_date, pe.op_start_date, pe.op_end_date, row_number() over (partition by pe.person_id order by pe.start_date ASC) as ordinal, cast(pe.visit_occurrence_id as bigint) as visit_occurrence_id - FROM primary_events pe - -) QE + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) +) C -; ---- Inclusion Rule Inserts +-- End Drug Exposure Criteria -select 0 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_0 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Demographic Criteria -SELECT 0 as index_id, e.person_id, e.event_id -FROM #qualified_events E -JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID -WHERE P.gender_concept_id in (8507) -GROUP BY e.person_id, e.event_id --- End Demographic Criteria +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id HAVING COUNT(index_id) = 1 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id -select 1 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_1 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM +UNION ALL +select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Demographic Criteria -SELECT 0 as index_id, e.person_id, e.event_id -FROM #qualified_events E -JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID -WHERE YEAR(E.start_date) - P.year_of_birth >= 18 -GROUP BY e.person_id, e.event_id --- End Demographic Criteria + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) +) C - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 -) G --- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria -select 2 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_2 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - +) PE JOIN ( -- Begin Criteria Group select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - select E.person_id, E.event_id - FROM #qualified_events E + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) +) C + +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date +) E INNER JOIN ( -- Begin Correlated Criteria select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria - -) PE +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date +) P JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) +) C + + +-- End Drug Exposure Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria + + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id + +UNION ALL +select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Criteria Group +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria + +) PE +JOIN ( +-- Begin Criteria Group select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -450,76 +453,61 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C --- End Condition Occurrence Criteria +-- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +select 1 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -538,231 +526,127 @@ JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id -- End Procedure Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) > 0 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date + ) E + JOIN @cdm_database_schema.observation_period OP on E.person_id = OP.person_id and E.start_date >= OP.observation_period_start_date and E.start_date <= op.observation_period_end_date + WHERE DATEADD(day,183,OP.OBSERVATION_PERIOD_START_DATE) <= E.START_DATE AND DATEADD(day,0,E.START_DATE) <= OP.OBSERVATION_PERIOD_END_DATE ) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) -) C - +WHERE P.ordinal = 1 +-- End Primary Events --- End Drug Exposure Criteria +) +SELECT event_id, person_id, start_date, end_date, op_start_date, op_end_date, visit_occurrence_id +INTO #qualified_events +FROM +( + select pe.event_id, pe.person_id, pe.start_date, pe.end_date, pe.op_start_date, pe.op_end_date, row_number() over (partition by pe.person_id order by pe.start_date ASC) as ordinal, cast(pe.visit_occurrence_id as bigint) as visit_occurrence_id + FROM primary_events pe + +) QE -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria +; - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 3 -) G --- End Criteria Group +--- Inclusion Rule Inserts -UNION ALL +select 0 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_0 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( -- Begin Criteria Group -select 1 as index_id, person_id, event_id +select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E + FROM #qualified_events E INNER JOIN ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date -from -( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 11) -) C - - --- End Procedure Occurrence Criteria + -- Begin Demographic Criteria +SELECT 0 as index_id, e.person_id, e.event_id +FROM #qualified_events E +JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID +WHERE P.gender_concept_id in (8507) +GROUP BY e.person_id, e.event_id +-- End Demographic Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date +select 1 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_1 FROM ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P + select pe.person_id, pe.event_id + FROM #qualified_events pe + JOIN ( - -- Begin Observation Criteria -select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, - C.visit_occurrence_id, C.observation_date as sort_date -from +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - select o.* - FROM @cdm_database_schema.OBSERVATION o -JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 11) -) C - - --- End Observation Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Demographic Criteria +SELECT 0 as index_id, e.person_id, e.event_id +FROM #qualified_events E +JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID +WHERE YEAR(E.start_date) - P.year_of_birth >= 18 +GROUP BY e.person_id, e.event_id +-- End Demographic Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) > 0 + HAVING COUNT(index_id) = 1 ) G -- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; -UNION ALL +select 2 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_2 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( -- Begin Criteria Group -select 2 as index_id, person_id, event_id +select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E + FROM #qualified_events E INNER JOIN ( -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +select 0 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -778,50 +662,18 @@ JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -845,42 +697,10 @@ HAVING COUNT(cc.event_id) = 0 UNION ALL -- Begin Correlated Criteria select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -904,42 +724,10 @@ HAVING COUNT(cc.event_id) = 0 UNION ALL -- Begin Correlated Criteria select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -963,101 +751,10 @@ HAVING COUNT(cc.event_id) = 0 UNION ALL -- Begin Correlated Criteria select 4 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 18) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -1067,7 +764,7 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 19) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C @@ -1078,576 +775,215 @@ GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria -UNION ALL --- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 -) G --- End Criteria Group - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 3 + HAVING COUNT(index_id) = 5 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +select 3 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_3 +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria - -) PE + select pe.person_id, pe.event_id + FROM #qualified_events pe + JOIN ( -- Begin Criteria Group select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E + FROM #qualified_events E INNER JOIN ( -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +select 0 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( -- Begin Condition Occurrence Criteria SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - - --- End Condition Occurrence Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date -from -( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) -) C - - --- End Procedure Occurrence Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Criteria Group -select 3 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Observation Criteria -select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, - C.visit_occurrence_id, C.observation_date as sort_date -from -( - select o.* - FROM @cdm_database_schema.OBSERVATION o -JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 11) -) C - - --- End Observation Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date -from -( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 11) -) C - - --- End Procedure Occurrence Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) > 0 -) G --- End Criteria Group - -UNION ALL --- Begin Criteria Group -select 4 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 10) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 10) ) C --- End Drug Exposure Criteria +-- End Observation Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 2 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; + +select 4 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_4 +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM +( + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria + +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM +( + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) +) C + +WHERE C.ordinal = 1 +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 18) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id +select 1 as index_id, p.person_id, p.event_id from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -1655,18 +991,18 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id LEFT JOIN ( SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -1680,33 +1016,33 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id +select 2 as index_id, p.person_id, p.event_id from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -1714,151 +1050,154 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id LEFT JOIN ( SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL --- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +-- Begin Criteria Group +select 3 as index_id, person_id, event_id +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM +( + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 19) + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 19) ) C --- End Drug Exposure Criteria +-- End Observation Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id +select 1 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 19) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 + HAVING COUNT(index_id) > 0 ) G -- End Criteria Group ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 5 + HAVING COUNT(index_id) = 4 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id @@ -1870,7 +1209,7 @@ HAVING COUNT(cc.event_id) >= 1 UNION ALL -- Begin Correlated Criteria -select 2 as index_id, cc.person_id, cc.event_id +select 1 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM #qualified_events P JOIN ( @@ -1882,7 +1221,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -1904,7 +1243,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -1927,7 +1266,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -1951,7 +1290,7 @@ FROM -- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria @@ -1967,7 +1306,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -1987,7 +1326,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -1998,18 +1337,19 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C --- End Procedure Occurrence Criteria +-- End Drug Exposure Criteria ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id @@ -2027,7 +1367,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -2047,7 +1387,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -2058,21 +1398,20 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria @@ -2091,7 +1430,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -2114,7 +1453,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -2125,18 +1464,18 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date from ( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 11) + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 19) ) C --- End Procedure Occurrence Criteria +-- End Observation Criteria ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id @@ -2155,7 +1494,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -2166,18 +1505,18 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Observation Criteria -select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, - C.visit_occurrence_id, C.observation_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select o.* - FROM @cdm_database_schema.OBSERVATION o -JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 11) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 19) ) C --- End Observation Criteria +-- End Procedure Occurrence Criteria ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id @@ -2190,138 +1529,46 @@ HAVING COUNT(cc.event_id) >= 1 ) G -- End Criteria Group -UNION ALL --- Begin Criteria Group -select 4 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) -) C - - --- End Drug Exposure Criteria + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 4 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria +select 2 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM #qualified_events P +JOIN ( + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) -) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +) PE JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date @@ -2329,18 +1576,20 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, @@ -2349,39 +1598,37 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 18) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id +select 1 as index_id, p.person_id, p.event_id from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, @@ -2390,11 +1637,10 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id @@ -2410,11 +1656,10 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id @@ -2429,20 +1674,20 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id +select 2 as index_id, p.person_id, p.event_id from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, @@ -2451,11 +1696,10 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id @@ -2471,40 +1715,41 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL --- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +-- Begin Criteria Group +select 3 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date @@ -2512,18 +1757,20 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, @@ -2532,39 +1779,37 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 19) + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 19) ) C --- End Drug Exposure Criteria +-- End Observation Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id +select 1 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria @@ -2574,45 +1819,43 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 19) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 + HAVING COUNT(index_id) > 0 ) G -- End Criteria Group ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 5 + HAVING COUNT(index_id) = 4 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id @@ -2624,63 +1867,13 @@ HAVING COUNT(cc.event_id) >= 1 ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) > 0 -) G --- End Criteria Group - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) >= 1 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; - -select 3 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_3 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from #qualified_events p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - -- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 12) -) C - - --- End Condition Occurrence Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) > 0 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id @@ -2695,7 +1888,9 @@ select inclusion_rule_id, person_id, event_id from #Inclusion_1 UNION ALL select inclusion_rule_id, person_id, event_id from #Inclusion_2 UNION ALL -select inclusion_rule_id, person_id, event_id from #Inclusion_3) I; +select inclusion_rule_id, person_id, event_id from #Inclusion_3 +UNION ALL +select inclusion_rule_id, person_id, event_id from #Inclusion_4) I; TRUNCATE TABLE #Inclusion_0; DROP TABLE #Inclusion_0; @@ -2708,6 +1903,9 @@ DROP TABLE #Inclusion_2; TRUNCATE TABLE #Inclusion_3; DROP TABLE #Inclusion_3; +TRUNCATE TABLE #Inclusion_4; +DROP TABLE #Inclusion_4; + with cteIncludedEvents(event_id, person_id, start_date, end_date, op_start_date, op_end_date, ordinal) as ( @@ -2721,13 +1919,13 @@ with cteIncludedEvents(event_id, person_id, start_date, end_date, op_start_date, ) MG -- matching groups -- the matching group with all bits set ( POWER(2,# of inclusion rules) - 1 = inclusion_rule_mask - WHERE (MG.inclusion_rule_mask = POWER(cast(2 as bigint),4)-1) + WHERE (MG.inclusion_rule_mask = POWER(cast(2 as bigint),5)-1) ) select event_id, person_id, start_date, end_date, op_start_date, op_end_date into #included_events FROM cteIncludedEvents Results -WHERE Results.ordinal = 1 + ; @@ -2751,7 +1949,7 @@ FROM ( SELECT co.* FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 12) + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 10) ) C diff --git a/inst/sql/sql_server/118.sql b/inst/sql/sql_server/118.sql index d3bd5d5..f01ffe1 100644 --- a/inst/sql/sql_server/118.sql +++ b/inst/sql/sql_server/118.sql @@ -7,7 +7,7 @@ CREATE TABLE #Codesets ( INSERT INTO #Codesets (codeset_id, concept_id) SELECT 1 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4205430,4201930,4264861,4264288,4246703,763131) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id @@ -40,22 +40,17 @@ WHERE E.concept_id is null ) C UNION ALL SELECT 4 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4304921,4145907,4341536) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4304921,4304921,4073142,4073143,4341536,4012324,4073141,4071936,4341536,4145907) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (4304921,4145907,4341536) + and ca.ancestor_concept_id in (4304921,4304921,4073142,4073143,4341536,4012324,4073141,4071936,4341536,4145907) and c.invalid_reason is null ) I LEFT JOIN ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (35608156,35624545,35624534,35624540,35624546,35624535,35624541,35624539,4021070,2780498,2780499,2780496,2780497,2780494,2780495,35624537,35624542,4012324) -UNION select c.concept_id - from @vocabulary_database_schema.CONCEPT c - join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (4012324) - and c.invalid_reason is null + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (35608156,35624545,35624534,35624540,35624546,35624535,35624541,35624539,4021070,2780498,2780499,2780496,2780497,2780494,2780495,35624537,35624542) ) E ON I.concept_id = E.concept_id WHERE E.concept_id is null @@ -71,7 +66,7 @@ UNION select c.concept_id ) I ) C UNION ALL -SELECT 9 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM +SELECT 7 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (3006575) UNION select c.concept_id @@ -82,129 +77,140 @@ UNION select c.concept_id ) I ) C UNION ALL -SELECT 11 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM +SELECT 10 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392,4312326) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533) + and ca.ancestor_concept_id in (443392,4312326) and c.invalid_reason is null ) I LEFT JOIN ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (2108677,4216658,4306299,4338661,3187777,40487861,4176312,4193061,2777698,2777697,2777700,2777699,2777702,2777701,2777704,2777703,2777706,2777705,44783041,4239543,2003966,4021570,2780477,2780478,2780479,2780480,4341384,4341893,4212360,4147673,4078386,4073700,4234536,4287859,44783043,4071791,4054558) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4112752,4111921,764971,36716186,200962,36712762,37395835,4164017,4141960,4163261,4183913,4283614,4289246,4283740,4280897,4289379) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (2108677,4306299,4338661,3187777,40487861,4176312,4193061,2777698,2777697,2777700,2777699,2777702,2777701,2777704,2777703,2777706,2777705,44783041,4239543,2003966,4021570,2780477,2780478,2780479,2780480,4341384,4341893,4212360,4147673,4078386,4073700,4234536,4287859,44783043,4071791,4054558) + and ca.ancestor_concept_id in (432851,4112752,4111921,764971,36716186,200962,36712762,37395835,4164017,4141960,4163261,4183913,4283614,4289246,4283740,4280897,4289379) and c.invalid_reason is null ) E ON I.concept_id = E.concept_id WHERE E.concept_id is null ) C UNION ALL -SELECT 12 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM +SELECT 11 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (443392) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (19058410,739471,35834903,1343039,19089810,1366310,1351541,1344381,19010792,1356461,1500211,1300978,1315286,35807385,35807349) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (443392) + and ca.ancestor_concept_id in (19058410,739471,35834903,1343039,19089810,1366310,1351541,1344381,19010792,1356461,1500211,1300978,1315286,35807385,35807349) and c.invalid_reason is null ) I -LEFT JOIN -( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (432851,4112752,4111921,764971,36716186,200962,36712762,37395835,4164017,4141960,4163261,4183913,4283614,4289246,4283740,4280897,4289379) +) C UNION ALL +SELECT 12 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM +( + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (40239056,963987,42900250,1361291) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (432851,4112752,4111921,764971,36716186,200962,36712762,37395835,4164017,4141960,4163261,4183913,4283614,4289246,4283740,4280897,4289379) + and ca.ancestor_concept_id in (40239056,963987,42900250,1361291) and c.invalid_reason is null -) E ON I.concept_id = E.concept_id -WHERE E.concept_id is null +) I ) C UNION ALL SELECT 13 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (19058410,739471,35834903,1343039,19089810,1366310,1351541,1344381,19010792,1356461,1500211,1300978,1315286,35807385,35807349) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (1315942,40222431,1378382) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (19058410,739471,35834903,1343039,19089810,1366310,1351541,1344381,19010792,1356461,1500211,1300978,1315286,35807385,35807349) + and ca.ancestor_concept_id in (1315942,40222431,1378382) and c.invalid_reason is null ) I ) C UNION ALL SELECT 14 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (40239056,963987,42900250,1361291) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (44816340) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (40239056,963987,42900250,1361291) + and ca.ancestor_concept_id in (44816340) and c.invalid_reason is null ) I ) C UNION ALL SELECT 15 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (1315942,40222431,1378382) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (45892579,1718850) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (1315942,40222431,1378382) + and ca.ancestor_concept_id in (45892579,1718850) and c.invalid_reason is null ) I ) C UNION ALL SELECT 16 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (44816340) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (44816340) + and ca.ancestor_concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) and c.invalid_reason is null ) I ) C UNION ALL SELECT 17 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (45892579,1718850) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (45775578,902727,43526934) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (45892579,1718850) + and ca.ancestor_concept_id in (45775578,902727,43526934) and c.invalid_reason is null ) I +LEFT JOIN +( + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (41267222) + +) E ON I.concept_id = E.concept_id +WHERE E.concept_id is null ) C UNION ALL SELECT 18 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (3169330,4180749) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (586622,587503,784328,1830614,1832328,21021970,21090575,21120047,21159533,35129163,35139888,35604048,35604049,35604050,35604051,35803678,36056039,36056040,36065121,36065122,36224401,36238934,36247443,36247444,36271591,36278763,36404396,36405170,36780945,36780946,36780947,36780948,36780949,36787995,36787996,36787997,36787998,36787999,36788000,36788001,36788002,36788003,36788004,36788005,36879366,36880201,36885115,36889553,36889599,36892847,37592548,40224085,40224086,40224095,40224096,40224097,40716385,40745552,40745553,40745554,40745555,41079944,41122672,41133743,41271431,42658251,42921578,42963145,42963146,43173544,44075484,44081458,44082527,44084103,44124784,44164861,44164862,44175744,44184353,44191541,44191562,44191588,44191599,45775965,45775966,45775970,46276407,46276408,46276409,46276410,46276411,46276412,46276413,46276414,46276415,46276416) + and ca.ancestor_concept_id in (3169330,4180749) and c.invalid_reason is null ) I ) C UNION ALL SELECT 19 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (45775578,902727,43526934) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533,2110046,2110035,2108678,2101059,2777698,40490346,2110043,2789830,709928,42733763,42733764) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id - and ca.ancestor_concept_id in (45775578,902727,43526934) + and ca.ancestor_concept_id in (4235738,4330932,37396025,2108724,2108725,4198015,43533205,2790073,1781260,4041984,2789856,1524039,37111533,4061656,2789850,2789851,2789848,2789849,2789854,2789855,2789852,2789853,2789846,2789847,2789845,759648,4073126,2110047,37111533,2110046,2110035,2108678) and c.invalid_reason is null ) I LEFT JOIN ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (41267222) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (2108677,4216658,4306299,4338661,3187777,40487861,4176312,4193061,2777698,2777697,2777700,2777699,2777702,2777701,2777704,2777703,2777706,2777705,44783041,4239543,2003966,4021570,2780477,2780478,2780479,2780480,4341384,4341893,4212360,4147673,4078386,4073700,4234536,4287859,44783043,4071791,4054558) +UNION select c.concept_id + from @vocabulary_database_schema.CONCEPT c + join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id + and ca.ancestor_concept_id in (2108677,4306299,4338661,3187777,40487861,4176312,4193061,2777698,2777697,2777700,2777699,2777702,2777701,2777704,2777703,2777706,2777705,44783041,4239543,2003966,4021570,2780477,2780478,2780479,2780480,4341384,4341893,4212360,4147673,4078386,4073700,4234536,4287859,44783043,4071791,4054558) + and c.invalid_reason is null ) E ON I.concept_id = E.concept_id WHERE E.concept_id is null @@ -222,7 +228,8 @@ FROM OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date, cast(E.visit_occurrence_id as bigint) as visit_occurrence_id FROM ( - -- Begin Drug Exposure Criteria + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -230,29 +237,44 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria -UNION ALL --- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select po.* , row_number() over (PARTITION BY po.person_id ORDER BY po.procedure_date, po.procedure_occurrence_id) as ordinal - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C -WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) -AND C.ordinal = 1 --- End Procedure Occurrence Criteria - -UNION ALL --- Begin Drug Exposure Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -260,14 +282,41 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date +) P +JOIN ( + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from +( + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) +) C + + +-- End Drug Exposure Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria UNION ALL --- Begin Drug Exposure Criteria +-- Begin Correlated Criteria +select 1 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id +FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -275,186 +324,77 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria - - ) E - JOIN @cdm_database_schema.observation_period OP on E.person_id = OP.person_id and E.start_date >= OP.observation_period_start_date and E.start_date <= op.observation_period_end_date - WHERE DATEADD(day,183,OP.OBSERVATION_PERIOD_START_DATE) <= E.START_DATE AND DATEADD(day,0,E.START_DATE) <= OP.OBSERVATION_PERIOD_END_DATE +) Q +JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id + and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P - --- End Primary Events - -) -SELECT event_id, person_id, start_date, end_date, op_start_date, op_end_date, visit_occurrence_id -INTO #qualified_events -FROM +JOIN ( + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - select pe.event_id, pe.person_id, pe.start_date, pe.end_date, pe.op_start_date, pe.op_end_date, row_number() over (partition by pe.person_id order by pe.start_date ASC) as ordinal, cast(pe.visit_occurrence_id as bigint) as visit_occurrence_id - FROM primary_events pe - -) QE + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) +) C -; ---- Inclusion Rule Inserts +-- End Drug Exposure Criteria -select 0 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_0 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Demographic Criteria -SELECT 0 as index_id, e.person_id, e.event_id -FROM #qualified_events E -JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID -WHERE P.gender_concept_id in (8507) -GROUP BY e.person_id, e.event_id --- End Demographic Criteria +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 +-- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) = 2 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id -select 1 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_1 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM +UNION ALL +select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Demographic Criteria -SELECT 0 as index_id, e.person_id, e.event_id -FROM #qualified_events E -JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID -WHERE YEAR(E.start_date) - P.year_of_birth >= 18 -GROUP BY e.person_id, e.event_id --- End Demographic Criteria + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) +) C - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 -) G --- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria -select 2 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_2 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - +) PE JOIN ( -- Begin Criteria Group select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria - -) PE -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -465,82 +405,48 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Procedure Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C --- End Condition Occurrence Criteria +-- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +select 1 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Procedure Occurrence Criteria +FROM (-- Begin Procedure Occurrence Criteria select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, C.visit_occurrence_id, C.procedure_date as sort_date from @@ -550,49 +456,8 @@ from JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C - +WHERE (C.procedure_date >= DATEFROMPARTS(2016, 1, 1) and C.procedure_date <= DATEFROMPARTS(2020, 12, 31)) -- End Procedure Occurrence Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -612,36 +477,55 @@ JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 3 + HAVING COUNT(index_id) = 2 ) G -- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id UNION ALL +select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from +( + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) +) C + +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria + +) PE +JOIN ( -- Begin Criteria Group -select 1 as index_id, person_id, event_id +select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -652,106 +536,63 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 11) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C --- End Procedure Occurrence Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Observation Criteria -select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, - C.visit_occurrence_id, C.observation_date as sort_date -from -( - select o.* - FROM @cdm_database_schema.OBSERVATION o -JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 11) -) C - - --- End Observation Criteria +-- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) > 0 -) G --- End Criteria Group - UNION ALL -- Begin Criteria Group -select 2 as index_id, person_id, event_id +select 1 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -762,18 +603,19 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -787,13 +629,13 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria @@ -803,83 +645,58 @@ UNION ALL select 1 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) > 0 +) G +-- End Criteria Group -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 2 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria +UNION ALL +select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -887,52 +704,56 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C - +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +) PE +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from +( + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -946,58 +767,25 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 12) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL --- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +-- Begin Criteria Group +select 1 as index_id, person_id, event_id +FROM ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, C.visit_occurrence_id,C.drug_exposure_start_date as sort_date @@ -1005,111 +793,92 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 18) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C - +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) -- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) -) C - -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Device Exposure Criteria +select C.person_id, C.device_exposure_id as event_id, C.device_exposure_start_date as start_date, COALESCE(C.device_exposure_end_date, DATEADD(day,1,C.device_exposure_start_date)) as end_date, + C.visit_occurrence_id, C.device_exposure_start_date as sort_date from ( select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 19) + FROM @cdm_database_schema.DEVICE_EXPOSURE de +JOIN #Codesets cs on (de.device_concept_id = cs.concept_id and cs.codeset_id = 11) ) C --- End Drug Exposure Criteria +-- End Device Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id +select 1 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM +FROM (-- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date +from ( - SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) ) C -WHERE C.ordinal = 1 --- End Condition Occurrence Criteria +WHERE (C.drug_exposure_start_date >= DATEFROMPARTS(2016, 1, 1) and C.drug_exposure_start_date <= DATEFROMPARTS(2020, 12, 31)) +-- End Drug Exposure Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id @@ -1118,161 +887,169 @@ HAVING COUNT(cc.event_id) >= 1 ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 + HAVING COUNT(index_id) > 0 ) G -- End Criteria Group ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 3 + HAVING COUNT(index_id) = 2 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria + ) E + JOIN @cdm_database_schema.observation_period OP on E.person_id = OP.person_id and E.start_date >= OP.observation_period_start_date and E.start_date <= op.observation_period_end_date + WHERE DATEADD(day,183,OP.OBSERVATION_PERIOD_START_DATE) <= E.START_DATE AND DATEADD(day,0,E.START_DATE) <= OP.OBSERVATION_PERIOD_END_DATE +) P +WHERE P.ordinal = 1 +-- End Primary Events -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( --- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +) +SELECT event_id, person_id, start_date, end_date, op_start_date, op_end_date, visit_occurrence_id +INTO #qualified_events +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C + select pe.event_id, pe.person_id, pe.start_date, pe.end_date, pe.op_start_date, pe.op_end_date, row_number() over (partition by pe.person_id order by pe.start_date ASC) as ordinal, cast(pe.visit_occurrence_id as bigint) as visit_occurrence_id + FROM primary_events pe + +) QE -WHERE C.ordinal = 1 --- End Measurement Criteria +; -) PE +--- Inclusion Rule Inserts + +select 0 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_0 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + JOIN ( -- Begin Criteria Group select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E + FROM #qualified_events E INNER JOIN ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C + -- Begin Demographic Criteria +SELECT 0 as index_id, e.person_id, e.event_id +FROM #qualified_events E +JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID +WHERE P.gender_concept_id in (8507) +GROUP BY e.person_id, e.event_id +-- End Demographic Criteria -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; + +select 1 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_1 FROM ( - SELECT co.* - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) -) C - - --- End Condition Occurrence Criteria + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Demographic Criteria +SELECT 0 as index_id, e.person_id, e.event_id +FROM #qualified_events E +JOIN @cdm_database_schema.PERSON P ON P.PERSON_ID = E.PERSON_ID +WHERE YEAR(E.start_date) - P.year_of_birth >= 18 +GROUP BY e.person_id, e.event_id +-- End Demographic Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 1 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +select 2 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_2 +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM #qualified_events E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, p.person_id, p.event_id +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date +FROM #qualified_events P +JOIN ( + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) ) C -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P + +-- End Drug Exposure Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria + +UNION ALL +-- Begin Correlated Criteria +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( - -- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) ) C --- End Procedure Occurrence Criteria +-- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria @@ -1280,42 +1057,37 @@ HAVING COUNT(cc.event_id) = 0 UNION ALL -- Begin Correlated Criteria select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p +from #qualified_events p LEFT JOIN ( SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date +FROM #qualified_events P +JOIN ( + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) ) C -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P + +-- End Drug Exposure Criteria + +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 +-- End Correlated Criteria + +UNION ALL +-- Begin Correlated Criteria +select 3 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( -- Begin Drug Exposure Criteria select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, @@ -1325,308 +1097,226 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria -UNION ALL + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 4 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; + +select 3 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_3 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( -- Begin Criteria Group -select 3 as index_id, person_id, event_id +select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E + FROM #qualified_events E INNER JOIN ( -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +select 0 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( - -- Begin Observation Criteria -select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, - C.visit_occurrence_id, C.observation_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select o.* - FROM @cdm_database_schema.OBSERVATION o -JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 11) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 10) ) C --- End Observation Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +select 1 as index_id, p.person_id, p.event_id +from #qualified_events p +LEFT JOIN ( +SELECT p.person_id, p.event_id +FROM #qualified_events P JOIN ( - -- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date from ( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 11) + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 10) ) C --- End Procedure Occurrence Criteria +-- End Observation Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +GROUP BY p.person_id, p.event_id +HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) > 0 + HAVING COUNT(index_id) = 2 ) G -- End Criteria Group +) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id +) Results +; -UNION ALL +select 4 as inclusion_rule_id, person_id, event_id +INTO #Inclusion_4 +FROM +( + select pe.person_id, pe.event_id + FROM #qualified_events pe + +JOIN ( -- Begin Criteria Group -select 4 as index_id, person_id, event_id +select 0 as index_id, person_id, event_id FROM ( select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from + FROM #qualified_events E + INNER JOIN + ( + -- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E + select E.person_id, E.event_id + FROM #qualified_events E INNER JOIN ( -- Begin Correlated Criteria select 0 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) -) C - -WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +FROM #qualified_events P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P +-- End Condition Occurrence Criteria + +) PE JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 18) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id +select 1 as index_id, p.person_id, p.event_id from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -1634,18 +1324,18 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id LEFT JOIN ( SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -1659,33 +1349,33 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id +select 2 as index_id, p.person_id, p.event_id from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date @@ -1693,151 +1383,154 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id LEFT JOIN ( SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL --- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +-- Begin Criteria Group +select 3 as index_id, person_id, event_id +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM +( + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 19) + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 19) ) C --- End Drug Exposure Criteria +-- End Observation Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id +select 1 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from +FROM (-- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) + SELECT co.* , row_number() over (PARTITION BY co.person_id ORDER BY co.condition_start_date, co.condition_occurrence_id) as ordinal + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 1) ) C WHERE C.ordinal = 1 --- End Measurement Criteria +-- End Condition Occurrence Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 19) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 + HAVING COUNT(index_id) > 0 ) G -- End Criteria Group ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 5 + HAVING COUNT(index_id) = 4 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id @@ -1849,7 +1542,7 @@ HAVING COUNT(cc.event_id) >= 1 UNION ALL -- Begin Correlated Criteria -select 2 as index_id, cc.person_id, cc.event_id +select 1 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM #qualified_events P JOIN ( @@ -1861,7 +1554,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -1883,7 +1576,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -1906,7 +1599,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -1930,7 +1623,7 @@ FROM -- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria @@ -1946,7 +1639,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -1966,7 +1659,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -1977,18 +1670,19 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date + -- Begin Drug Exposure Criteria +select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, + COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, + C.visit_occurrence_id,C.drug_exposure_start_date as sort_date from ( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) + select de.* + FROM @cdm_database_schema.DRUG_EXPOSURE de +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C --- End Procedure Occurrence Criteria +-- End Drug Exposure Criteria ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id @@ -2006,7 +1700,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -2026,7 +1720,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -2037,21 +1731,20 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria @@ -2070,7 +1763,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -2093,7 +1786,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -2104,18 +1797,18 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Procedure Occurrence Criteria -select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, - C.visit_occurrence_id, C.procedure_date as sort_date + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date from ( - select po.* - FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po -JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 11) + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 19) ) C --- End Procedure Occurrence Criteria +-- End Observation Criteria ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id @@ -2134,7 +1827,7 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 7) ) C WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) @@ -2145,18 +1838,18 @@ JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Observation Criteria -select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, - C.visit_occurrence_id, C.observation_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select o.* - FROM @cdm_database_schema.OBSERVATION o -JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 11) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 19) ) C --- End Observation Criteria +-- End Procedure Occurrence Criteria ) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id @@ -2164,124 +1857,51 @@ HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) > 0 -) G --- End Criteria Group - -UNION ALL --- Begin Criteria Group -select 4 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, cc.person_id, cc.event_id -from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria -select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, - C.visit_occurrence_id, C.measurement_date as sort_date -from -( - select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal - FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) -) C - -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 --- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P -JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from -( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 14) -) C - + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) > 0 +) G +-- End Criteria Group --- End Drug Exposure Criteria + ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id + GROUP BY E.person_id, E.event_id + HAVING COUNT(index_id) = 4 +) G +-- End Criteria Group +) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,-183,P.START_DATE) AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 1 as index_id, cc.person_id, cc.event_id +select 2 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id -FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date -FROM (-- Begin Measurement Criteria +FROM #qualified_events P +JOIN ( + select PE.person_id, PE.event_id, PE.start_date, PE.end_date, PE.visit_occurrence_id, PE.sort_date FROM ( +-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria -) Q -JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id - and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) P + +) PE JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from +-- Begin Criteria Group +select 0 as index_id, person_id, event_id +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 15) -) C - - --- End Drug Exposure Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc -GROUP BY cc.person_id, cc.event_id -HAVING COUNT(cc.event_id) >= 1 --- End Correlated Criteria - -UNION ALL --- Begin Correlated Criteria -select 2 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date @@ -2289,18 +1909,20 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, @@ -2309,39 +1931,37 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date -from + -- Begin Condition Occurrence Criteria +SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, + C.visit_occurrence_id, C.condition_start_date as sort_date +FROM ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 18) + SELECT co.* + FROM @cdm_database_schema.CONDITION_OCCURRENCE co + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 2) ) C --- End Drug Exposure Criteria +-- End Condition Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 3 as index_id, p.person_id, p.event_id +select 1 as index_id, p.person_id, p.event_id from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, @@ -2350,11 +1970,10 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id @@ -2370,11 +1989,10 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id @@ -2389,20 +2007,20 @@ from ( select de.* FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 16) +JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 11) ) C -- End Drug Exposure Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 4 as index_id, p.person_id, p.event_id +select 2 as index_id, p.person_id, p.event_id from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, @@ -2411,11 +2029,10 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id @@ -2431,40 +2048,41 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 17) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 4) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-1,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id GROUP BY p.person_id, p.event_id HAVING COUNT(cc.event_id) = 0 -- End Correlated Criteria UNION ALL --- Begin Correlated Criteria -select 5 as index_id, p.person_id, p.event_id -from (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date +-- Begin Criteria Group +select 3 as index_id, person_id, event_id +FROM +( + select E.person_id, E.event_id + FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, C.visit_occurrence_id, C.measurement_date as sort_date @@ -2472,18 +2090,20 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date -) p -LEFT JOIN ( -SELECT p.person_id, p.event_id +) E + INNER JOIN + ( + -- Begin Correlated Criteria +select 0 as index_id, cc.person_id, cc.event_id +from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, DATEADD(d,1,C.measurement_date) as END_DATE, @@ -2492,39 +2112,37 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Observation Criteria +select C.person_id, C.observation_id as event_id, C.observation_date as start_date, DATEADD(d,1,C.observation_date) as END_DATE, + C.visit_occurrence_id, C.observation_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 19) + select o.* + FROM @cdm_database_schema.OBSERVATION o +JOIN #Codesets cs on (o.observation_concept_id = cs.concept_id and cs.codeset_id = 19) ) C --- End Drug Exposure Criteria +-- End Observation Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc +GROUP BY cc.person_id, cc.event_id +HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria UNION ALL -- Begin Correlated Criteria -select 6 as index_id, cc.person_id, cc.event_id +select 1 as index_id, cc.person_id, cc.event_id from (SELECT p.person_id, p.event_id FROM (SELECT Q.person_id, Q.event_id, Q.start_date, Q.end_date, Q.visit_occurrence_id, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date FROM (-- Begin Measurement Criteria @@ -2534,45 +2152,43 @@ from ( select m.* , row_number() over (PARTITION BY m.person_id ORDER BY m.measurement_date, m.measurement_id) as ordinal FROM @cdm_database_schema.MEASUREMENT m -JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 9) +JOIN #Codesets cs on (m.measurement_concept_id = cs.concept_id and cs.codeset_id = 6) ) C -WHERE C.value_as_concept_id in (45878386,45881618,45882500,45876322) -AND C.ordinal = 1 +WHERE C.ordinal = 1 -- End Measurement Criteria ) Q JOIN @cdm_database_schema.OBSERVATION_PERIOD OP on Q.person_id = OP.person_id and OP.observation_period_start_date <= Q.start_date and OP.observation_period_end_date >= Q.start_date ) P JOIN ( - -- Begin Drug Exposure Criteria -select C.person_id, C.drug_exposure_id as event_id, C.drug_exposure_start_date as start_date, - COALESCE(C.DRUG_EXPOSURE_END_DATE, DATEADD(day,C.DAYS_SUPPLY,DRUG_EXPOSURE_START_DATE), DATEADD(day,1,C.DRUG_EXPOSURE_START_DATE)) as end_date, - C.visit_occurrence_id,C.drug_exposure_start_date as sort_date + -- Begin Procedure Occurrence Criteria +select C.person_id, C.procedure_occurrence_id as event_id, C.procedure_date as start_date, DATEADD(d,1,C.procedure_date) as END_DATE, + C.visit_occurrence_id, C.procedure_date as sort_date from ( - select de.* - FROM @cdm_database_schema.DRUG_EXPOSURE de -JOIN #Codesets cs on (de.drug_concept_id = cs.concept_id and cs.codeset_id = 13) + select po.* + FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po +JOIN #Codesets cs on (po.procedure_concept_id = cs.concept_id and cs.codeset_id = 19) ) C --- End Drug Exposure Criteria +-- End Procedure Occurrence Criteria -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= DATEADD(day,0,P.START_DATE) AND A.START_DATE <= DATEADD(day,183,P.START_DATE) ) cc +) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,-184,P.START_DATE) ) cc GROUP BY cc.person_id, cc.event_id HAVING COUNT(cc.event_id) >= 1 -- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 7 + HAVING COUNT(index_id) > 0 ) G -- End Criteria Group ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 5 + HAVING COUNT(index_id) = 4 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id and AC.event_id = pe.event_id @@ -2584,63 +2200,13 @@ HAVING COUNT(cc.event_id) >= 1 ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) > 0 -) G --- End Criteria Group - - ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id - GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) >= 1 ) G -- End Criteria Group -) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id -) Results -; - -select 3 as inclusion_rule_id, person_id, event_id -INTO #Inclusion_3 -FROM -( - select pe.person_id, pe.event_id - FROM #qualified_events pe - -JOIN ( --- Begin Criteria Group -select 0 as index_id, person_id, event_id -FROM -( - select E.person_id, E.event_id - FROM #qualified_events E - INNER JOIN - ( - -- Begin Correlated Criteria -select 0 as index_id, p.person_id, p.event_id -from #qualified_events p -LEFT JOIN ( -SELECT p.person_id, p.event_id -FROM #qualified_events P -JOIN ( - -- Begin Condition Occurrence Criteria -SELECT C.person_id, C.condition_occurrence_id as event_id, C.condition_start_date as start_date, COALESCE(C.condition_end_date, DATEADD(day,1,C.condition_start_date)) as end_date, - C.visit_occurrence_id, C.condition_start_date as sort_date -FROM -( - SELECT co.* - FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 12) -) C - - --- End Condition Occurrence Criteria - -) A on A.person_id = P.person_id AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= P.OP_END_DATE AND A.START_DATE >= P.OP_START_DATE AND A.START_DATE <= DATEADD(day,30,P.START_DATE) ) cc on p.person_id = cc.person_id and p.event_id = cc.event_id -GROUP BY p.person_id, p.event_id -HAVING COUNT(cc.event_id) = 0 --- End Correlated Criteria ) CQ on E.person_id = CQ.person_id and E.event_id = CQ.event_id GROUP BY E.person_id, E.event_id - HAVING COUNT(index_id) = 1 + HAVING COUNT(index_id) > 0 ) G -- End Criteria Group ) AC on AC.person_id = pe.person_id AND AC.event_id = pe.event_id @@ -2655,7 +2221,9 @@ select inclusion_rule_id, person_id, event_id from #Inclusion_1 UNION ALL select inclusion_rule_id, person_id, event_id from #Inclusion_2 UNION ALL -select inclusion_rule_id, person_id, event_id from #Inclusion_3) I; +select inclusion_rule_id, person_id, event_id from #Inclusion_3 +UNION ALL +select inclusion_rule_id, person_id, event_id from #Inclusion_4) I; TRUNCATE TABLE #Inclusion_0; DROP TABLE #Inclusion_0; @@ -2668,6 +2236,9 @@ DROP TABLE #Inclusion_2; TRUNCATE TABLE #Inclusion_3; DROP TABLE #Inclusion_3; +TRUNCATE TABLE #Inclusion_4; +DROP TABLE #Inclusion_4; + with cteIncludedEvents(event_id, person_id, start_date, end_date, op_start_date, op_end_date, ordinal) as ( @@ -2681,13 +2252,13 @@ with cteIncludedEvents(event_id, person_id, start_date, end_date, op_start_date, ) MG -- matching groups -- the matching group with all bits set ( POWER(2,# of inclusion rules) - 1 = inclusion_rule_mask - WHERE (MG.inclusion_rule_mask = POWER(cast(2 as bigint),4)-1) + WHERE (MG.inclusion_rule_mask = POWER(cast(2 as bigint),5)-1) ) select event_id, person_id, start_date, end_date, op_start_date, op_end_date into #included_events FROM cteIncludedEvents Results -WHERE Results.ordinal = 1 + ; @@ -2711,7 +2282,7 @@ FROM ( SELECT co.* FROM @cdm_database_schema.CONDITION_OCCURRENCE co - JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 12) + JOIN #Codesets cs on (co.condition_concept_id = cs.concept_id and cs.codeset_id = 10) ) C diff --git a/inst/sql/sql_server/218.sql b/inst/sql/sql_server/218.sql index 9e54ef5..92921bd 100644 --- a/inst/sql/sql_server/218.sql +++ b/inst/sql/sql_server/218.sql @@ -40,7 +40,7 @@ WHERE E.concept_id is null ) C UNION ALL SELECT 2 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4261375,4120252) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4261375,4120252,4023102,4022963) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id diff --git a/inst/sql/sql_server/320.sql b/inst/sql/sql_server/320.sql index 6c6184a..3e7b78a 100644 --- a/inst/sql/sql_server/320.sql +++ b/inst/sql/sql_server/320.sql @@ -7,7 +7,7 @@ CREATE TABLE #Codesets ( INSERT INTO #Codesets (codeset_id, concept_id) SELECT 0 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4217238) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4217238,2106845) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id diff --git a/inst/sql/sql_server/335.sql b/inst/sql/sql_server/335.sql index 6c6184a..3e7b78a 100644 --- a/inst/sql/sql_server/335.sql +++ b/inst/sql/sql_server/335.sql @@ -7,7 +7,7 @@ CREATE TABLE #Codesets ( INSERT INTO #Codesets (codeset_id, concept_id) SELECT 0 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4217238) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4217238,2106845) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id diff --git a/inst/sql/sql_server/336.sql b/inst/sql/sql_server/336.sql index 1400a0a..759d274 100644 --- a/inst/sql/sql_server/336.sql +++ b/inst/sql/sql_server/336.sql @@ -29,7 +29,7 @@ WHERE E.concept_id is null ) C UNION ALL SELECT 1 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM ( - select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4302356,36713242,2792841,2792848,2792855,2788819,2211381,2211380,2211425,2793060,2211512,4061009,4058336,4058335) + select concept_id from @vocabulary_database_schema.CONCEPT where concept_id in (4302356,36713242,2792841,2792848,2792855,2788819,2211381,2211380,2211425,2793060,2211512,4061009,4058336,4058335,3027941,36305710,43055219,43055217,43055218,3035261,3029076,36305511,3049252,3013610,36303622,3019825,3018999) UNION select c.concept_id from @vocabulary_database_schema.CONCEPT c join @vocabulary_database_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id