From de8c1d0f234ac2945c921124b36cbfeae2751a48 Mon Sep 17 00:00:00 2001 From: Tom White Date: Thu, 6 Jul 2017 09:48:01 +0100 Subject: [PATCH] Change empty 'invalid_reason' field to null for compatibility with Atlas cohort generation. --- Impala/OMOP_Parquet.sql | 8 ++++---- Impala/OMOP_Parquet_v5.1.sql | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Impala/OMOP_Parquet.sql b/Impala/OMOP_Parquet.sql index bb2b65a..62eabcc 100644 --- a/Impala/OMOP_Parquet.sql +++ b/Impala/OMOP_Parquet.sql @@ -15,7 +15,7 @@ SELECT concept_code, TO_UTC_TIMESTAMP(CONCAT_WS('-', SUBSTR(CAST(valid_start_date AS STRING), 1, 4), SUBSTR(CAST(valid_start_date AS STRING), 5, 2), SUBSTR(CAST(valid_start_date AS STRING), 7, 2)), 'UTC') AS valid_start_date, TO_UTC_TIMESTAMP(CONCAT_WS('-', SUBSTR(CAST(valid_end_date AS STRING), 1, 4), SUBSTR(CAST(valid_end_date AS STRING), 5, 2), SUBSTR(CAST(valid_end_date AS STRING), 7, 2)), 'UTC') AS valid_end_date, - invalid_reason + nullif(invalid_reason, '') AS invalid_reason FROM omop_cdm.concept; CREATE TABLE omop_cdm_parquet.vocabulary @@ -42,7 +42,7 @@ SELECT relationship_id, TO_UTC_TIMESTAMP(CONCAT_WS('-', SUBSTR(CAST(valid_start_date AS STRING), 1, 4), SUBSTR(CAST(valid_start_date AS STRING), 5, 2), SUBSTR(CAST(valid_start_date AS STRING), 7, 2)), 'UTC') AS valid_start_date, TO_UTC_TIMESTAMP(CONCAT_WS('-', SUBSTR(CAST(valid_end_date AS STRING), 1, 4), SUBSTR(CAST(valid_end_date AS STRING), 5, 2), SUBSTR(CAST(valid_end_date AS STRING), 7, 2)), 'UTC') AS valid_end_date, - invalid_reason + nullif(invalid_reason, '') AS invalid_reason FROM omop_cdm.concept_relationship; CREATE TABLE omop_cdm_parquet.relationship @@ -72,7 +72,7 @@ SELECT target_vocabulary_id, TO_UTC_TIMESTAMP(CONCAT_WS('-', SUBSTR(CAST(valid_start_date AS STRING), 1, 4), SUBSTR(CAST(valid_start_date AS STRING), 5, 2), SUBSTR(CAST(valid_start_date AS STRING), 7, 2)), 'UTC') AS valid_start_date, TO_UTC_TIMESTAMP(CONCAT_WS('-', SUBSTR(CAST(valid_end_date AS STRING), 1, 4), SUBSTR(CAST(valid_end_date AS STRING), 5, 2), SUBSTR(CAST(valid_end_date AS STRING), 7, 2)), 'UTC') AS valid_end_date, - invalid_reason + nullif(invalid_reason, '') AS invalid_reason FROM omop_cdm.source_to_concept_map; CREATE TABLE omop_cdm_parquet.drug_strength @@ -90,7 +90,7 @@ SELECT box_size, TO_UTC_TIMESTAMP(CONCAT_WS('-', SUBSTR(CAST(valid_start_date AS STRING), 1, 4), SUBSTR(CAST(valid_start_date AS STRING), 5, 2), SUBSTR(CAST(valid_start_date AS STRING), 7, 2)), 'UTC') AS valid_start_date, TO_UTC_TIMESTAMP(CONCAT_WS('-', SUBSTR(CAST(valid_end_date AS STRING), 1, 4), SUBSTR(CAST(valid_end_date AS STRING), 5, 2), SUBSTR(CAST(valid_end_date AS STRING), 7, 2)), 'UTC') AS valid_end_date, - invalid_reason + nullif(invalid_reason, '') AS invalid_reason FROM omop_cdm.drug_strength; CREATE TABLE omop_cdm_parquet.cohort_definition diff --git a/Impala/OMOP_Parquet_v5.1.sql b/Impala/OMOP_Parquet_v5.1.sql index ed89658..6c1b447 100644 --- a/Impala/OMOP_Parquet_v5.1.sql +++ b/Impala/OMOP_Parquet_v5.1.sql @@ -15,7 +15,7 @@ SELECT concept_code, TO_UTC_TIMESTAMP(CONCAT_WS('-', SUBSTR(CAST(valid_start_date AS STRING), 1, 4), SUBSTR(CAST(valid_start_date AS STRING), 5, 2), SUBSTR(CAST(valid_start_date AS STRING), 7, 2)), 'UTC') AS valid_start_date, TO_UTC_TIMESTAMP(CONCAT_WS('-', SUBSTR(CAST(valid_end_date AS STRING), 1, 4), SUBSTR(CAST(valid_end_date AS STRING), 5, 2), SUBSTR(CAST(valid_end_date AS STRING), 7, 2)), 'UTC') AS valid_end_date, - invalid_reason + nullif(invalid_reason, '') AS invalid_reason FROM omop_cdm.concept; CREATE TABLE omop_cdm_parquet.vocabulary @@ -42,7 +42,7 @@ SELECT relationship_id, TO_UTC_TIMESTAMP(CONCAT_WS('-', SUBSTR(CAST(valid_start_date AS STRING), 1, 4), SUBSTR(CAST(valid_start_date AS STRING), 5, 2), SUBSTR(CAST(valid_start_date AS STRING), 7, 2)), 'UTC') AS valid_start_date, TO_UTC_TIMESTAMP(CONCAT_WS('-', SUBSTR(CAST(valid_end_date AS STRING), 1, 4), SUBSTR(CAST(valid_end_date AS STRING), 5, 2), SUBSTR(CAST(valid_end_date AS STRING), 7, 2)), 'UTC') AS valid_end_date, - invalid_reason + nullif(invalid_reason, '') AS invalid_reason FROM omop_cdm.concept_relationship; CREATE TABLE omop_cdm_parquet.relationship @@ -72,7 +72,7 @@ SELECT target_vocabulary_id, TO_UTC_TIMESTAMP(CONCAT_WS('-', SUBSTR(CAST(valid_start_date AS STRING), 1, 4), SUBSTR(CAST(valid_start_date AS STRING), 5, 2), SUBSTR(CAST(valid_start_date AS STRING), 7, 2)), 'UTC') AS valid_start_date, TO_UTC_TIMESTAMP(CONCAT_WS('-', SUBSTR(CAST(valid_end_date AS STRING), 1, 4), SUBSTR(CAST(valid_end_date AS STRING), 5, 2), SUBSTR(CAST(valid_end_date AS STRING), 7, 2)), 'UTC') AS valid_end_date, - invalid_reason + nullif(invalid_reason, '') AS invalid_reason FROM omop_cdm.source_to_concept_map; CREATE TABLE omop_cdm_parquet.drug_strength @@ -90,7 +90,7 @@ SELECT box_size, TO_UTC_TIMESTAMP(CONCAT_WS('-', SUBSTR(CAST(valid_start_date AS STRING), 1, 4), SUBSTR(CAST(valid_start_date AS STRING), 5, 2), SUBSTR(CAST(valid_start_date AS STRING), 7, 2)), 'UTC') AS valid_start_date, TO_UTC_TIMESTAMP(CONCAT_WS('-', SUBSTR(CAST(valid_end_date AS STRING), 1, 4), SUBSTR(CAST(valid_end_date AS STRING), 5, 2), SUBSTR(CAST(valid_end_date AS STRING), 7, 2)), 'UTC') AS valid_end_date, - invalid_reason + nullif(invalid_reason, '') AS invalid_reason FROM omop_cdm.drug_strength; CREATE TABLE omop_cdm_parquet.cohort_definition