From 934f723067599609e4fdac91153c54a12bdbe174 Mon Sep 17 00:00:00 2001 From: Anton Ivanov Date: Thu, 16 May 2024 10:23:33 +0300 Subject: [PATCH 01/13] HCPCS logic updated, premier --- .../Core/Transformation/Premier/Batch.sql | 3 +- .../Premier/Lookups/Measurement.sql | 4 +- .../Premier/Lookups/Observation.sql | 4 +- .../Premier/Lookups/ObservationICD10.sql | 4 +- .../Premier/Lookups/ObservationICD9.sql | 4 +- .../Premier/Lookups/Procedure.sql | 4 +- .../Definitions/EntityDefinition.cs | 68 +++++++++++++++++-- .../Lookups/Lookup.cs | 10 ++- .../Lookups/LookupValue.cs | 7 +- 9 files changed, 89 insertions(+), 19 deletions(-) diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql index 27156060..67130d7a 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql @@ -1,4 +1,5 @@ SELECT DISTINCT {0} medrec_key, medrec_key FROM {sc}.pat WHERE medrec_key is not NULL -order by 1 \ No newline at end of file +order by 1 +limit 1000000 \ No newline at end of file diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/Measurement.sql b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/Measurement.sql index 2f694b6e..bb3d0e18 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/Measurement.sql +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/Measurement.sql @@ -5,7 +5,7 @@ FROM Source_to_Standard WHERE lower(SOURCE_VOCABULARY_ID) IN ('cpt4', 'hcpcs', 'icd10cm', 'icd9cm', 'jnj_pmr_proc_chrg_cd') AND lower(TARGET_DOMAIN_ID) = 'measurement' ), Source as ( -SELECT distinct SOURCE_CODE, TARGET_CONCEPT_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE +SELECT distinct SOURCE_CODE, TARGET_CONCEPT_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE, SOURCE_INVALID_REASON FROM Source_to_Source WHERE lower(SOURCE_VOCABULARY_ID) IN ('cpt4', 'hcpcs') AND lower(TARGET_VOCABULARY_ID) IN ('cpt4', 'hcpcs') AND lower(TARGET_DOMAIN_ID)='measurement' @@ -16,7 +16,7 @@ union select SOURCE_CODE from Source ) -select distinct S_S.SOURCE_CODE, Standard.TARGET_CONCEPT_ID, Standard.TARGET_DOMAIN_ID, Standard.VALID_START_DATE, Standard.VALID_END_DATE, Standard.SOURCE_VOCABULARY_ID, Source.TARGET_CONCEPT_ID as SOURCE_TARGET_CONCEPT_ID, Source.SOURCE_VALID_START_DATE as SOURCE_VALID_START_DATE, Source.SOURCE_VALID_END_DATE, ingredient_level.ingredient_concept_id, Standard.TARGET_VALUE_AS_CONCEPT_ID +select distinct S_S.SOURCE_CODE, Standard.TARGET_CONCEPT_ID, Standard.TARGET_DOMAIN_ID, Standard.VALID_START_DATE, Standard.VALID_END_DATE, Standard.SOURCE_VOCABULARY_ID, Source.TARGET_CONCEPT_ID as SOURCE_TARGET_CONCEPT_ID, Source.SOURCE_VALID_START_DATE as SOURCE_VALID_START_DATE, Source.SOURCE_VALID_END_DATE, ingredient_level.ingredient_concept_id, Standard.TARGET_VALUE_AS_CONCEPT_ID, Source.SOURCE_INVALID_REASON from S_S left join Standard on Standard.SOURCE_CODE = S_S.SOURCE_CODE left join Source on Source.SOURCE_CODE = S_S.SOURCE_CODE diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/Observation.sql b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/Observation.sql index c65376d8..48ff8790 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/Observation.sql +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/Observation.sql @@ -10,7 +10,7 @@ FROM Source_to_Source WHERE lower(SOURCE_VOCABULARY_ID) IN ('icd9cm', 'cpt4', 'hcpcs', 'mdc') AND lower(TARGET_VOCABULARY_ID) IN ('icd9cm', 'cpt4', 'hcpcs', 'mdc') and lower(TARGET_DOMAIN_ID)='observation' union -SELECT distinct SOURCE_CODE, TARGET_CONCEPT_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE +SELECT distinct SOURCE_CODE, TARGET_CONCEPT_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE, SOURCE_INVALID_REASON FROM Source_to_Source WHERE lower(SOURCE_VOCABULARY_ID) IN ('drg') AND lower(TARGET_VOCABULARY_ID) IN ('drg') and lower(TARGET_DOMAIN_ID)='observation' @@ -21,7 +21,7 @@ union select SOURCE_CODE from Source ) -select distinct S_S.SOURCE_CODE, Standard.TARGET_CONCEPT_ID, Standard.TARGET_DOMAIN_ID, Standard.VALID_START_DATE, Standard.VALID_END_DATE, Standard.SOURCE_VOCABULARY_ID, Source.TARGET_CONCEPT_ID as SOURCE_TARGET_CONCEPT_ID, Source.SOURCE_VALID_START_DATE as SOURCE_VALID_START_DATE, Source.SOURCE_VALID_END_DATE, ingredient_level.ingredient_concept_id, Standard.TARGET_VALUE_AS_CONCEPT_ID +select distinct S_S.SOURCE_CODE, Standard.TARGET_CONCEPT_ID, Standard.TARGET_DOMAIN_ID, Standard.VALID_START_DATE, Standard.VALID_END_DATE, Standard.SOURCE_VOCABULARY_ID, Source.TARGET_CONCEPT_ID as SOURCE_TARGET_CONCEPT_ID, Source.SOURCE_VALID_START_DATE as SOURCE_VALID_START_DATE, Source.SOURCE_VALID_END_DATE, ingredient_level.ingredient_concept_id, Standard.TARGET_VALUE_AS_CONCEPT_ID, Source.SOURCE_INVALID_REASON from S_S left join Standard on Standard.SOURCE_CODE = S_S.SOURCE_CODE left join Source on Source.SOURCE_CODE = S_S.SOURCE_CODE diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/ObservationICD10.sql b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/ObservationICD10.sql index 9efc4b08..1572f0a6 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/ObservationICD10.sql +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/ObservationICD10.sql @@ -4,7 +4,7 @@ SELECT distinct SOURCE_CODE, TARGET_CONCEPT_ID, TARGET_DOMAIN_ID, SOURCE_VALID_S FROM Source_to_Standard WHERE lower(SOURCE_VOCABULARY_ID) IN ('icd10cm') and lower(TARGET_DOMAIN_ID) = 'observation' ), Source as ( -SELECT distinct SOURCE_CODE, TARGET_CONCEPT_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE +SELECT distinct SOURCE_CODE, TARGET_CONCEPT_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE, SOURCE_INVALID_REASON FROM Source_to_Source WHERE lower(SOURCE_VOCABULARY_ID) IN ('icd9cm', 'cpt4', 'hcpcs', 'icd10cm') AND lower(TARGET_VOCABULARY_ID) IN ('icd9cm', 'cpt4', 'hcpcs', 'icd10cm') @@ -15,7 +15,7 @@ union select SOURCE_CODE from Source ) -select distinct S_S.SOURCE_CODE, Standard.TARGET_CONCEPT_ID, Standard.TARGET_DOMAIN_ID, Standard.VALID_START_DATE, Standard.VALID_END_DATE, Standard.SOURCE_VOCABULARY_ID, Source.TARGET_CONCEPT_ID as SOURCE_TARGET_CONCEPT_ID, Source.SOURCE_VALID_START_DATE as SOURCE_VALID_START_DATE, Source.SOURCE_VALID_END_DATE, ingredient_level.ingredient_concept_id, Standard.TARGET_VALUE_AS_CONCEPT_ID +select distinct S_S.SOURCE_CODE, Standard.TARGET_CONCEPT_ID, Standard.TARGET_DOMAIN_ID, Standard.VALID_START_DATE, Standard.VALID_END_DATE, Standard.SOURCE_VOCABULARY_ID, Source.TARGET_CONCEPT_ID as SOURCE_TARGET_CONCEPT_ID, Source.SOURCE_VALID_START_DATE as SOURCE_VALID_START_DATE, Source.SOURCE_VALID_END_DATE, ingredient_level.ingredient_concept_id, Standard.TARGET_VALUE_AS_CONCEPT_ID, Source.SOURCE_INVALID_REASON from S_S left join Standard on Standard.SOURCE_CODE = S_S.SOURCE_CODE left join Source on Source.SOURCE_CODE = S_S.SOURCE_CODE diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/ObservationICD9.sql b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/ObservationICD9.sql index c4636873..b656a685 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/ObservationICD9.sql +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/ObservationICD9.sql @@ -4,7 +4,7 @@ SELECT distinct SOURCE_CODE, TARGET_CONCEPT_ID, TARGET_DOMAIN_ID, SOURCE_VALID_S FROM Source_to_Standard WHERE lower(SOURCE_VOCABULARY_ID) IN ('icd9cm') and lower(TARGET_DOMAIN_ID) = 'observation' ), Source as ( -SELECT distinct SOURCE_CODE, TARGET_CONCEPT_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE +SELECT distinct SOURCE_CODE, TARGET_CONCEPT_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE, SOURCE_INVALID_REASON FROM Source_to_Source WHERE lower(SOURCE_VOCABULARY_ID) IN ('icd9cm', 'cpt4', 'hcpcs', 'icd10cm') AND lower(TARGET_VOCABULARY_ID) IN ('icd9cm', 'cpt4', 'hcpcs', 'icd10cm') @@ -15,7 +15,7 @@ union select SOURCE_CODE from Source ) -select distinct S_S.SOURCE_CODE, Standard.TARGET_CONCEPT_ID, Standard.TARGET_DOMAIN_ID, Standard.VALID_START_DATE, Standard.VALID_END_DATE, Standard.SOURCE_VOCABULARY_ID, Source.TARGET_CONCEPT_ID as SOURCE_TARGET_CONCEPT_ID, Source.SOURCE_VALID_START_DATE as SOURCE_VALID_START_DATE, Source.SOURCE_VALID_END_DATE, ingredient_level.ingredient_concept_id, Standard.TARGET_VALUE_AS_CONCEPT_ID +select distinct S_S.SOURCE_CODE, Standard.TARGET_CONCEPT_ID, Standard.TARGET_DOMAIN_ID, Standard.VALID_START_DATE, Standard.VALID_END_DATE, Standard.SOURCE_VOCABULARY_ID, Source.TARGET_CONCEPT_ID as SOURCE_TARGET_CONCEPT_ID, Source.SOURCE_VALID_START_DATE as SOURCE_VALID_START_DATE, Source.SOURCE_VALID_END_DATE, ingredient_level.ingredient_concept_id, Standard.TARGET_VALUE_AS_CONCEPT_ID, Source.SOURCE_INVALID_REASON from S_S left join Standard on Standard.SOURCE_CODE = S_S.SOURCE_CODE left join Source on Source.SOURCE_CODE = S_S.SOURCE_CODE diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/Procedure.sql b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/Procedure.sql index ed23163c..d95f8dde 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/Procedure.sql +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/Procedure.sql @@ -11,7 +11,7 @@ OR lower(SOURCE_VOCABULARY_ID) IN ('jnj_pmr_proc_chrg_cd') AND TARGET_CONCEPT_ID=0 ) ), Source as ( -SELECT distinct SOURCE_CODE, TARGET_CONCEPT_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE +SELECT distinct SOURCE_CODE, TARGET_CONCEPT_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE, SOURCE_INVALID_REASON FROM Source_to_Source WHERE lower(SOURCE_VOCABULARY_ID) IN ('cpt4', 'hcpcs', 'icd10cm', 'icd10pcs', 'icd9cm', 'icd9proc' ) AND lower(TARGET_VOCABULARY_ID) IN ('cpt4', 'hcpcs', 'icd10cm', 'icd10pcs', 'icd9cm', 'icd9proc' ) AND lower(TARGET_DOMAIN_ID)='procedure' @@ -22,7 +22,7 @@ union select SOURCE_CODE from Source ) -select distinct S_S.SOURCE_CODE, Standard.TARGET_CONCEPT_ID, Standard.TARGET_DOMAIN_ID, Standard.VALID_START_DATE, Standard.VALID_END_DATE, Standard.SOURCE_VOCABULARY_ID, Source.TARGET_CONCEPT_ID as SOURCE_TARGET_CONCEPT_ID, Source.SOURCE_VALID_START_DATE as SOURCE_VALID_START_DATE, Source.SOURCE_VALID_END_DATE, ingredient_level.ingredient_concept_id, Standard.TARGET_VALUE_AS_CONCEPT_ID +select distinct S_S.SOURCE_CODE, Standard.TARGET_CONCEPT_ID, Standard.TARGET_DOMAIN_ID, Standard.VALID_START_DATE, Standard.VALID_END_DATE, Standard.SOURCE_VOCABULARY_ID, Source.TARGET_CONCEPT_ID as SOURCE_TARGET_CONCEPT_ID, Source.SOURCE_VALID_START_DATE as SOURCE_VALID_START_DATE, Source.SOURCE_VALID_END_DATE, ingredient_level.ingredient_concept_id, Standard.TARGET_VALUE_AS_CONCEPT_ID, Source.SOURCE_INVALID_REASON from S_S left join Standard on Standard.SOURCE_CODE = S_S.SOURCE_CODE left join Source on Source.SOURCE_CODE = S_S.SOURCE_CODE diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Definitions/EntityDefinition.cs b/sources/Framework/org.ohdsi.cdm.framework.common3/Definitions/EntityDefinition.cs index 7a985136..c1266e6e 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Definitions/EntityDefinition.cs +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Definitions/EntityDefinition.cs @@ -87,6 +87,8 @@ public virtual IEnumerable GetConcepts(Concept concept, IDataRecord rea if (!string.IsNullOrEmpty(field.SourceKey)) sourceValue = reader.GetString(field.SourceKey); + var result = new List(); + var newConceptIds = new List>(); foreach (var lookupValue in concept.GetConceptIdValues(Vocabulary, field, reader)) { var cId = lookupValue.ConceptId; @@ -95,7 +97,6 @@ public virtual IEnumerable GetConcepts(Concept concept, IDataRecord rea if (!concept.IdRequired || cId.HasValue) { - var providerIdKey = reader.GetString(ProviderIdKey); if (!string.IsNullOrEmpty(providerIdKey)) providerIdKey = providerIdKey.TrimStart('0'); @@ -106,7 +107,6 @@ public virtual IEnumerable GetConcepts(Concept concept, IDataRecord rea ingredients = [.. lookupValue.Ingredients]; } - if (!string.IsNullOrEmpty(StartTime)) { if (DateTime.TryParse(reader.GetString(StartTime), out var dt)) @@ -134,7 +134,28 @@ public virtual IEnumerable GetConcepts(Concept concept, IDataRecord rea } } - yield return new Entity + foreach (var sc in lookupValue.SourceConcepts) + { + if (char.ToLower(sc.InvalidReason) != 'r') + continue; + + long newSourceConceptId = 0; + long newConceptId = 0; + if (sc.ConceptId > 0 && startDate.Between(sc.ValidStartDate, sc.ValidEndDate)) + { + newSourceConceptId = sc.ConceptId; + } + + if (lookupValue.ConceptId.HasValue && + lookupValue.ConceptId.Value > 0 && + startDate.Between(lookupValue.ValidStartDate, lookupValue.ValidEndDate)) + { + newConceptId = lookupValue.ConceptId.Value; + } + newConceptIds.Add(new Tuple(newSourceConceptId, newConceptId, lookupValue.Domain)); + } + + result.Add(new Entity { IsUnique = IsUnique, PersonId = personId.Value, @@ -157,9 +178,48 @@ public virtual IEnumerable GetConcepts(Concept concept, IDataRecord rea VocabularySourceValue = lookupValue.SourceCode, Ingredients = ingredients, ValueAsConceptId = lookupValue.ValueAsConceptId - }; + }); + } + } + + // SourceConceptId, ConceptId, Domain + Tuple newMap = null; + if (newConceptIds.Count > 0) // Fix for invalid_reason = 'R' + { + // SourceConceptId + var r1 = newConceptIds.Where(c => c.Item1 > 0); + if (r1.Any()) + { + // ConceptId + var r2 = r1.Where(c => c.Item2 > 0); + if (r2.Any()) + { + newMap = r2.FirstOrDefault(); + } + } + else + { + var r2 = newConceptIds.Where(c => c.Item2 > 0); + if (r2.Any()) + { + newMap = r2.FirstOrDefault(); + } } + + newMap ??= r1.FirstOrDefault(); + } + + foreach (var item in result) + { + if (newMap != null) + { + item.SourceConceptId = newMap.Item1; + item.ConceptId = newMap.Item2; + item.Domain = newMap.Item3; + } + + yield return item; } } } diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Lookups/Lookup.cs b/sources/Framework/org.ohdsi.cdm.framework.common3/Lookups/Lookup.cs index 6a6fbdf5..9740cb93 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Lookups/Lookup.cs +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Lookups/Lookup.cs @@ -179,6 +179,7 @@ public void Fill(AmazonS3Client client, string bucket, string prefix) var sourceValidStartDate = DateTime.MinValue; var sourceValidEndDate = DateTime.MaxValue; + var invalidReason = char.MinValue; if (spliter.Results.Length > 6) { @@ -186,11 +187,18 @@ public void Fill(AmazonS3Client client, string bucket, string prefix) DateTime.TryParse(spliter.Results[8], out sourceValidEndDate); } + if (spliter.Results.Length > 11) + { + if (!IsNullOrEmpty(spliter.Results[11])) + invalidReason = spliter.Results[11][0]; + } + value.SourceConcepts.Add(new SourceConcepts { ConceptId = sourceConceptId, ValidStartDate = sourceValidStartDate, - ValidEndDate = sourceValidEndDate + ValidEndDate = sourceValidEndDate, + InvalidReason = invalidReason }); if (!IsNullOrEmpty(spliter.Results[9]) && diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Lookups/LookupValue.cs b/sources/Framework/org.ohdsi.cdm.framework.common3/Lookups/LookupValue.cs index c00210bd..6b14b744 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Lookups/LookupValue.cs +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Lookups/LookupValue.cs @@ -1,5 +1,4 @@ -using org.ohdsi.cdm.framework.common.Omop; -using System; +using System; using System.Collections.Generic; namespace org.ohdsi.cdm.framework.common.Lookups @@ -9,12 +8,14 @@ public class SourceConcepts : IEquatable public long ConceptId { get; set; } public DateTime ValidStartDate { get; set; } public DateTime ValidEndDate { get; set; } + public char InvalidReason { get; set; } public bool Equals(SourceConcepts other) { return this.ConceptId == other.ConceptId && this.ValidStartDate.Equals(other.ValidStartDate) && - this.ValidEndDate.Equals(other.ValidEndDate); + this.ValidEndDate.Equals(other.ValidEndDate) && + this.InvalidReason.Equals(other.InvalidReason); } public override int GetHashCode() From aa296d6f462320a0fc02009093713e5ec7aa4919 Mon Sep 17 00:00:00 2001 From: Anton Ivanov Date: Thu, 16 May 2024 11:46:46 +0300 Subject: [PATCH 02/13] Update Observation.sql --- .../Core/Transformation/Premier/Lookups/Observation.sql | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/Observation.sql b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/Observation.sql index 48ff8790..1891cb08 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/Observation.sql +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/Observation.sql @@ -5,7 +5,7 @@ FROM Source_to_Standard WHERE lower(SOURCE_VOCABULARY_ID) IN ('cpt4', 'drg', 'hcpcs', 'jnj_pmr_obs_code', 'jnj_pmr_proc_chrg_cd') AND lower(TARGET_DOMAIN_ID) = 'observation' ), Source as ( -SELECT distinct SOURCE_CODE, TARGET_CONCEPT_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE +SELECT distinct SOURCE_CODE, TARGET_CONCEPT_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE, null as SOURCE_INVALID_REASON FROM Source_to_Source WHERE lower(SOURCE_VOCABULARY_ID) IN ('icd9cm', 'cpt4', 'hcpcs', 'mdc') AND lower(TARGET_VOCABULARY_ID) IN ('icd9cm', 'cpt4', 'hcpcs', 'mdc') and lower(TARGET_DOMAIN_ID)='observation' @@ -25,7 +25,4 @@ select distinct S_S.SOURCE_CODE, Standard.TARGET_CONCEPT_ID, Standard.TARGET_DOM from S_S left join Standard on Standard.SOURCE_CODE = S_S.SOURCE_CODE left join Source on Source.SOURCE_CODE = S_S.SOURCE_CODE -left join ingredient_level on ingredient_level.concept_id = Standard.TARGET_CONCEPT_ID - - - +left join ingredient_level on ingredient_level.concept_id = Standard.TARGET_CONCEPT_ID \ No newline at end of file From 5d3a8907f5c4f41229908109bce8de6b0cfc5ebc Mon Sep 17 00:00:00 2001 From: Anton Ivanov Date: Thu, 16 May 2024 13:06:11 +0300 Subject: [PATCH 03/13] Update Batch.sql --- .../Core/Transformation/Premier/Batch.sql | 53 ++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql index 67130d7a..61f4e957 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql @@ -1,5 +1,56 @@ SELECT DISTINCT {0} medrec_key, medrec_key FROM {sc}.pat -WHERE medrec_key is not NULL +WHERE medrec_key is not NULL and medrec_key in +( +SELECT DISTINCT cast(pat.medrec_key as bigint) as medrec_key +FROM {sc}.pat +JOIN {sc}.patcpt cpt ON PAT.PAT_KEY = cpt.pat_key +where cpt.cpt_code in +( +'A4560', +'CS', +'G0030', +'G0031', +'G0032', +'G0033', +'G0034', +'G0035', +'G0036', +'G0037', +'G0038', +'G0039', +'G0040', +'G0041', +'G0042', +'G0043', +'G0044', +'G0045', +'G0046', +'G0047', +'G0050', +'G0308', +'G0309', +'G0310', +'G0311', +'G0312', +'G0313', +'G0314', +'G0315', +'G0316', +'G0317', +'G0318', +'G0320', +'G0321', +'G0322', +'G0323', +'G0327', +'J1440', +'J9350', +'J9380', +'Q2040', +'Q2041', +'Q2042' +) +) order by 1 limit 1000000 \ No newline at end of file From 6fd14177577b0d6fff58944eb54b640f645c23b0 Mon Sep 17 00:00:00 2001 From: Anton Ivanov Date: Thu, 16 May 2024 14:48:36 +0300 Subject: [PATCH 04/13] fixes --- .../Core/Transformation/Premier/Lookups/Observation.sql | 2 +- .../Core/Transformation/Premier/PremierPersonBuilder.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/Observation.sql b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/Observation.sql index 1891cb08..ea371f6e 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/Observation.sql +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/Observation.sql @@ -5,7 +5,7 @@ FROM Source_to_Standard WHERE lower(SOURCE_VOCABULARY_ID) IN ('cpt4', 'drg', 'hcpcs', 'jnj_pmr_obs_code', 'jnj_pmr_proc_chrg_cd') AND lower(TARGET_DOMAIN_ID) = 'observation' ), Source as ( -SELECT distinct SOURCE_CODE, TARGET_CONCEPT_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE, null as SOURCE_INVALID_REASON +SELECT distinct SOURCE_CODE, TARGET_CONCEPT_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE, SOURCE_INVALID_REASON FROM Source_to_Source WHERE lower(SOURCE_VOCABULARY_ID) IN ('icd9cm', 'cpt4', 'hcpcs', 'mdc') AND lower(TARGET_VOCABULARY_ID) IN ('icd9cm', 'cpt4', 'hcpcs', 'mdc') and lower(TARGET_DOMAIN_ID)='observation' diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/PremierPersonBuilder.cs b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/PremierPersonBuilder.cs index 5b94ba1b..cc8a7597 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/PremierPersonBuilder.cs +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/PremierPersonBuilder.cs @@ -112,7 +112,7 @@ public override Attrition Build(ChunkData data, KeyMasterOffsetManager o) // MONTH_OF_BIRTH and DAY_OF_BIRTH are not available in Premier, // because age is the only available field. YEAR_OF_BIRTH is calculated from the first admission. // The admission year minus the age results in the YEAR_OF_BIRTH. - foreach (var personRecord in PersonRecords) + foreach (var personRecord in PersonRecords.Where(p => p.YearOfBirth.HasValue)) { if (!visitsDictionary.ContainsKey(personRecord.SourceRecordGuid)) continue; @@ -135,6 +135,7 @@ public override Attrition Build(ChunkData data, KeyMasterOffsetManager o) } } + // If a person has YEAR_OF_BIRTH that varies over two years then those records are eliminated if (maxYearOfBirth - minYearOfBirth > 2) { From 9299456665e0fd28ced582a04891c2ddcf3369fb Mon Sep 17 00:00:00 2001 From: Anton Ivanov Date: Thu, 16 May 2024 17:49:03 +0300 Subject: [PATCH 05/13] Update Batch.sql --- .../Core/Transformation/Premier/Batch.sql | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql index 61f4e957..7fe60958 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql @@ -1,8 +1,4 @@ -SELECT DISTINCT {0} medrec_key, medrec_key -FROM {sc}.pat -WHERE medrec_key is not NULL and medrec_key in -( -SELECT DISTINCT cast(pat.medrec_key as bigint) as medrec_key +SELECT DISTINCT medrec_key, medrec_key FROM {sc}.pat JOIN {sc}.patcpt cpt ON PAT.PAT_KEY = cpt.pat_key where cpt.cpt_code in @@ -51,6 +47,5 @@ where cpt.cpt_code in 'Q2041', 'Q2042' ) -) order by 1 limit 1000000 \ No newline at end of file From 3dc0e96423ca3a4c652817f1f39c90dba7fa873d Mon Sep 17 00:00:00 2001 From: Anton Ivanov Date: Thu, 16 May 2024 18:58:18 +0300 Subject: [PATCH 06/13] Update Batch.sql --- .../Core/Transformation/Premier/Batch.sql | 28 +------------------ 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql index 7fe60958..daac4602 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql @@ -3,26 +3,6 @@ FROM {sc}.pat JOIN {sc}.patcpt cpt ON PAT.PAT_KEY = cpt.pat_key where cpt.cpt_code in ( -'A4560', -'CS', -'G0030', -'G0031', -'G0032', -'G0033', -'G0034', -'G0035', -'G0036', -'G0037', -'G0038', -'G0039', -'G0040', -'G0041', -'G0042', -'G0043', -'G0044', -'G0045', -'G0046', -'G0047', 'G0050', 'G0308', 'G0309', @@ -39,13 +19,7 @@ where cpt.cpt_code in 'G0321', 'G0322', 'G0323', -'G0327', -'J1440', -'J9350', -'J9380', -'Q2040', -'Q2041', -'Q2042' +'G0327' ) order by 1 limit 1000000 \ No newline at end of file From b9e671f1e7bd4bed8a4334f89e848c036e83cdb8 Mon Sep 17 00:00:00 2001 From: Anton Ivanov Date: Fri, 17 May 2024 10:47:22 +0300 Subject: [PATCH 07/13] fix --- .../Core/Transformation/Premier/Batch.sql | 21 +------------------ .../Transformation/Premier/Lookups/Device.sql | 19 ++++++++++++++--- .../Premier/Lookups/DrugCpt.sql | 16 ++++++++++++-- 3 files changed, 31 insertions(+), 25 deletions(-) diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql index daac4602..a9c914b1 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql @@ -1,25 +1,6 @@ SELECT DISTINCT medrec_key, medrec_key FROM {sc}.pat JOIN {sc}.patcpt cpt ON PAT.PAT_KEY = cpt.pat_key -where cpt.cpt_code in -( -'G0050', -'G0308', -'G0309', -'G0310', -'G0311', -'G0312', -'G0313', -'G0314', -'G0315', -'G0316', -'G0317', -'G0318', -'G0320', -'G0321', -'G0322', -'G0323', -'G0327' -) +where cpt.cpt_code in ('J1440', 'J9350', 'J9380', 'Q2040', 'Q2041', 'Q2042') order by 1 limit 1000000 \ No newline at end of file diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/Device.sql b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/Device.sql index 58b7ad1d..7cedcae6 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/Device.sql +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/Device.sql @@ -1,10 +1,23 @@ {base}, Standard as ( -SELECT distinct SOURCE_CODE, TARGET_CONCEPT_ID, TARGET_DOMAIN_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE +SELECT distinct SOURCE_CODE, TARGET_CONCEPT_ID, TARGET_DOMAIN_ID, SOURCE_VALID_START_DATE as VALID_START_DATE, SOURCE_VALID_END_DATE as VALID_END_DATE, SOURCE_VOCABULARY_ID, TARGET_VALUE_AS_CONCEPT_ID FROM Source_to_Standard WHERE lower(SOURCE_VOCABULARY_ID) IN ('hcpcs', 'icd10cm', 'jnj_pmr_proc_chrg_cd', 'jnj_pmr_hosp_chg') AND lower(TARGET_DOMAIN_ID) IN ('device') +), Source as ( +SELECT distinct SOURCE_CODE, TARGET_CONCEPT_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE, SOURCE_INVALID_REASON +FROM Source_to_Source +WHERE lower(SOURCE_VOCABULARY_ID) IN ('hcpcs', 'icd10cm') +AND lower(TARGET_VOCABULARY_ID) IN ('hcpcs', 'icd10cm') AND lower(TARGET_DOMAIN_ID)='device' +), S_S as +( +select SOURCE_CODE from Standard +union +select SOURCE_CODE from Source ) -select distinct Standard.* -from Standard \ No newline at end of file +select distinct S_S.SOURCE_CODE, Standard.TARGET_CONCEPT_ID, Standard.TARGET_DOMAIN_ID, Standard.VALID_START_DATE, Standard.VALID_END_DATE, Standard.SOURCE_VOCABULARY_ID, Source.TARGET_CONCEPT_ID as SOURCE_TARGET_CONCEPT_ID, Source.SOURCE_VALID_START_DATE as SOURCE_VALID_START_DATE, Source.SOURCE_VALID_END_DATE, ingredient_level.ingredient_concept_id, Standard.TARGET_VALUE_AS_CONCEPT_ID, Source.SOURCE_INVALID_REASON +from S_S +left join Standard on Standard.SOURCE_CODE = S_S.SOURCE_CODE +left join Source on Source.SOURCE_CODE = S_S.SOURCE_CODE +left join ingredient_level on ingredient_level.concept_id = Standard.TARGET_CONCEPT_ID \ No newline at end of file diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/DrugCpt.sql b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/DrugCpt.sql index 03cdeda5..b179ea09 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/DrugCpt.sql +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Lookups/DrugCpt.sql @@ -4,8 +4,20 @@ SELECT distinct SOURCE_CODE, TARGET_CONCEPT_ID, TARGET_DOMAIN_ID, SOURCE_VALID_S FROM Source_to_Standard WHERE lower(SOURCE_VOCABULARY_ID) IN ('cpt4', 'hcpcs') AND lower(TARGET_DOMAIN_ID) = 'drug' +), Source as ( +SELECT distinct SOURCE_CODE, TARGET_CONCEPT_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE, SOURCE_INVALID_REASON +FROM Source_to_Source +WHERE lower(SOURCE_VOCABULARY_ID) IN ('cpt4', 'hcpcs') +AND lower(TARGET_VOCABULARY_ID) IN ('cpt4', 'hcpcs') AND lower(TARGET_DOMAIN_ID)='drug' +), S_S as +( +select SOURCE_CODE from Standard +union +select SOURCE_CODE from Source ) -select distinct Standard.SOURCE_CODE, Standard.TARGET_CONCEPT_ID, Standard.TARGET_DOMAIN_ID, Standard.VALID_START_DATE, Standard.VALID_END_DATE, Standard.SOURCE_VOCABULARY_ID, NULL as SOURCE_TARGET_CONCEPT_ID, NULL as SOURCE_VALID_START_DATE, NULL AS SOURCE_VALID_END_DATE, ingredient_level.ingredient_concept_id, Standard.TARGET_VALUE_AS_CONCEPT_ID -from Standard +select distinct S_S.SOURCE_CODE, Standard.TARGET_CONCEPT_ID, Standard.TARGET_DOMAIN_ID, Standard.VALID_START_DATE, Standard.VALID_END_DATE, Standard.SOURCE_VOCABULARY_ID, Source.TARGET_CONCEPT_ID as SOURCE_TARGET_CONCEPT_ID, Source.SOURCE_VALID_START_DATE as SOURCE_VALID_START_DATE, Source.SOURCE_VALID_END_DATE, ingredient_level.ingredient_concept_id, Standard.TARGET_VALUE_AS_CONCEPT_ID, Source.SOURCE_INVALID_REASON +from S_S +left join Standard on Standard.SOURCE_CODE = S_S.SOURCE_CODE +left join Source on Source.SOURCE_CODE = S_S.SOURCE_CODE left join ingredient_level on ingredient_level.concept_id = Standard.TARGET_CONCEPT_ID \ No newline at end of file From 9648e5c1e84b2daaa0a505f0266235aa17cbcaed Mon Sep 17 00:00:00 2001 From: Anton Ivanov Date: Mon, 20 May 2024 12:16:32 +0300 Subject: [PATCH 08/13] upd --- .../Base/PersonBuilder.cs | 75 +++++++++++++++++++ .../Premier/Definitions/vitals.xml | 2 +- .../Premier/PremierPersonBuilder.cs | 8 ++ .../Definitions/EntityDefinition.cs | 75 ++----------------- .../Omop/Entity.cs | 14 ++-- .../Omop/IEntity.cs | 3 + 6 files changed, 104 insertions(+), 73 deletions(-) diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Base/PersonBuilder.cs b/sources/Framework/org.ohdsi.cdm.framework.common3/Base/PersonBuilder.cs index 3a2819e3..d59c5e4a 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Base/PersonBuilder.cs +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Base/PersonBuilder.cs @@ -1141,6 +1141,81 @@ public void JoinToVocabulary(IVocabulary vocabulary) Vocabulary ??= vocabulary; } + public static void UpdateRSourceConcept(IEnumerable records) + { + foreach (var record in records) + { + UpdateRSourceConcept(record); + } + } + + // Fix for invalid_reason = 'R' + private static void UpdateRSourceConcept(IEntity e) + { + if (e.SourceConcepts == null) + return; + + var newConceptIds = new List>(); + foreach (var sc in e.SourceConcepts) + { + if (char.ToLower(sc.InvalidReason) != 'r') + continue; + + long newSourceConceptId = 0; + long newConceptId = 0; + + if (sc.ConceptId > 0 && e.StartDate.Between(sc.ValidStartDate, sc.ValidEndDate)) + { + newSourceConceptId = sc.ConceptId; + } + + if (e.ConceptId > 0 && e.StartDate.Between(e.ValidStartDate, e.ValidEndDate)) + { + newConceptId = e.ConceptId; + } + + newConceptIds.Add(new Tuple(newSourceConceptId, newConceptId)); + } + + if (newConceptIds.Count > 0) + { + Tuple newMap = null; + // SourceConceptId + var r1 = newConceptIds.Where(c => c.Item1 > 0); + + if (r1.Any()) + { + // ConceptId + var r2 = r1.Where(c => c.Item2 > 0); + if (r2.Any()) + { + newMap = r2.FirstOrDefault(); + } + } + else + { + var r2 = newConceptIds.Where(c => c.Item2 > 0); + if (r2.Any()) + { + newMap = r2.FirstOrDefault(); + } + } + + newMap ??= r1.FirstOrDefault(); + + if (newMap != null) + { + e.SourceConceptId = newMap.Item1; + e.ConceptId = newMap.Item2; + } + else + { + e.SourceConceptId = 0; + e.ConceptId = 0; + } + } + } + #endregion } } diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Definitions/vitals.xml b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Definitions/vitals.xml index 9c05423f..af93933f 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Definitions/vitals.xml +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Definitions/vitals.xml @@ -64,7 +64,7 @@ - + {isloinc} = 0 medrec_key pat_key diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/PremierPersonBuilder.cs b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/PremierPersonBuilder.cs index cc8a7597..eaa755b1 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/PremierPersonBuilder.cs +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/PremierPersonBuilder.cs @@ -235,6 +235,14 @@ public override Attrition Build(ChunkData data, KeyMasterOffsetManager o) } ConditionForEra.Clear(); + + UpdateRSourceConcept(drugExposures); + UpdateRSourceConcept(conditionOccurrences); + UpdateRSourceConcept(procedureOccurrences); + UpdateRSourceConcept(observations); + UpdateRSourceConcept(measurements); + UpdateRSourceConcept(deviceExposure); + // push built entities to ChunkBuilder for further save to CDM database AddToChunk(person, death, observationPeriods, diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Definitions/EntityDefinition.cs b/sources/Framework/org.ohdsi.cdm.framework.common3/Definitions/EntityDefinition.cs index c1266e6e..0b9c2964 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Definitions/EntityDefinition.cs +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Definitions/EntityDefinition.cs @@ -87,8 +87,6 @@ public virtual IEnumerable GetConcepts(Concept concept, IDataRecord rea if (!string.IsNullOrEmpty(field.SourceKey)) sourceValue = reader.GetString(field.SourceKey); - var result = new List(); - var newConceptIds = new List>(); foreach (var lookupValue in concept.GetConceptIdValues(Vocabulary, field, reader)) { var cId = lookupValue.ConceptId; @@ -97,6 +95,7 @@ public virtual IEnumerable GetConcepts(Concept concept, IDataRecord rea if (!concept.IdRequired || cId.HasValue) { + var providerIdKey = reader.GetString(ProviderIdKey); if (!string.IsNullOrEmpty(providerIdKey)) providerIdKey = providerIdKey.TrimStart('0'); @@ -107,6 +106,7 @@ public virtual IEnumerable GetConcepts(Concept concept, IDataRecord rea ingredients = [.. lookupValue.Ingredients]; } + if (!string.IsNullOrEmpty(StartTime)) { if (DateTime.TryParse(reader.GetString(StartTime), out var dt)) @@ -127,35 +127,14 @@ public virtual IEnumerable GetConcepts(Concept concept, IDataRecord rea var sourceConceptId = lookupValue.SourceConcepts.Count != 0 ? lookupValue.SourceConcepts[0].ConceptId : 0; if (!string.IsNullOrEmpty(field.SourceConceptId)) { - var scId = reader.GetLong(field.SourceConceptId); - if(scId.HasValue) + var scId = reader.GetLong(field.SourceConceptId); + if (scId.HasValue) { sourceConceptId = scId.Value; } } - foreach (var sc in lookupValue.SourceConcepts) - { - if (char.ToLower(sc.InvalidReason) != 'r') - continue; - - long newSourceConceptId = 0; - long newConceptId = 0; - if (sc.ConceptId > 0 && startDate.Between(sc.ValidStartDate, sc.ValidEndDate)) - { - newSourceConceptId = sc.ConceptId; - } - - if (lookupValue.ConceptId.HasValue && - lookupValue.ConceptId.Value > 0 && - startDate.Between(lookupValue.ValidStartDate, lookupValue.ValidEndDate)) - { - newConceptId = lookupValue.ConceptId.Value; - } - newConceptIds.Add(new Tuple(newSourceConceptId, newConceptId, lookupValue.Domain)); - } - - result.Add(new Entity + yield return new Entity { IsUnique = IsUnique, PersonId = personId.Value, @@ -177,49 +156,11 @@ public virtual IEnumerable GetConcepts(Concept concept, IDataRecord rea //SourceVocabularyId = lookupValue.SourceVocabularyId, VocabularySourceValue = lookupValue.SourceCode, Ingredients = ingredients, - ValueAsConceptId = lookupValue.ValueAsConceptId - }); - } - } - - // SourceConceptId, ConceptId, Domain - Tuple newMap = null; - if (newConceptIds.Count > 0) // Fix for invalid_reason = 'R' - { - // SourceConceptId - var r1 = newConceptIds.Where(c => c.Item1 > 0); + ValueAsConceptId = lookupValue.ValueAsConceptId, + SourceConcepts = lookupValue.SourceConcepts, + }; - if (r1.Any()) - { - // ConceptId - var r2 = r1.Where(c => c.Item2 > 0); - if (r2.Any()) - { - newMap = r2.FirstOrDefault(); - } - } - else - { - var r2 = newConceptIds.Where(c => c.Item2 > 0); - if (r2.Any()) - { - newMap = r2.FirstOrDefault(); - } } - - newMap ??= r1.FirstOrDefault(); - } - - foreach (var item in result) - { - if (newMap != null) - { - item.SourceConceptId = newMap.Item1; - item.ConceptId = newMap.Item2; - item.Domain = newMap.Item3; - } - - yield return item; } } } diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Omop/Entity.cs b/sources/Framework/org.ohdsi.cdm.framework.common3/Omop/Entity.cs index 7a69c1e1..ee74ef99 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Omop/Entity.cs +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Omop/Entity.cs @@ -1,4 +1,5 @@ using org.ohdsi.cdm.framework.common.Enums; +using org.ohdsi.cdm.framework.common.Lookups; using System; using System.Collections.Generic; using System.Security.Cryptography; @@ -30,14 +31,19 @@ public class Entity : IEntity public string ProviderKey { get; set; } public Dictionary AdditionalFields { get; set; } + public List Ingredients { get; set; } + public List SourceConcepts { get; set; } + - // CDM v5 props public long SourceConceptId { get; set; } public string Domain { get; set; } public string VocabularySourceValue { get; set; } public long? ValueAsConceptId { get; set; } + public DateTime ValidStartDate { get; set; } + public DateTime ValidEndDate { get; set; } + public Entity() { @@ -74,10 +80,7 @@ public virtual bool IncludeInEra() public virtual EntityType GeEntityType() { return EntityType.Entity; - } - - public DateTime ValidStartDate { get; set; } - public DateTime ValidEndDate { get; set; } + } public void Init(IEntity ent) { @@ -102,6 +105,7 @@ public void Init(IEntity ent) ConceptIdKey = ent.ConceptIdKey; VocabularySourceValue = ent.VocabularySourceValue; ValueAsConceptId = ent.ValueAsConceptId; + SourceConcepts = ent.SourceConcepts; } public static long GetId(string key) diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Omop/IEntity.cs b/sources/Framework/org.ohdsi.cdm.framework.common3/Omop/IEntity.cs index 0963bafe..822b100b 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Omop/IEntity.cs +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Omop/IEntity.cs @@ -1,4 +1,5 @@ using org.ohdsi.cdm.framework.common.Enums; +using org.ohdsi.cdm.framework.common.Lookups; using System; using System.Collections.Generic; @@ -37,6 +38,8 @@ public interface IEntity string VocabularySourceValue { get; set; } long? ValueAsConceptId { get; set; } + List SourceConcepts { get; set; } + string GetKey(); } } From 91d1391e117aaa2cb657dfd79bf42d1a1009000a Mon Sep 17 00:00:00 2001 From: Anton Ivanov Date: Tue, 21 May 2024 19:50:20 +0300 Subject: [PATCH 09/13] upd --- .../Base/PersonBuilder.cs | 175 ++++++++++++------ .../Transformation/CPRD/CprdPersonBuilder.cs | 8 +- .../Premier/PremierPersonBuilder.cs | 19 +- .../Definitions/DeathDefinition.cs | 2 +- .../Definitions/EntityDefinition.cs | 4 +- .../Definitions/ProviderDefinition.cs | 4 +- .../Lookups/LookupValue.cs | 10 +- 7 files changed, 137 insertions(+), 85 deletions(-) diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Base/PersonBuilder.cs b/sources/Framework/org.ohdsi.cdm.framework.common3/Base/PersonBuilder.cs index d59c5e4a..8e7243eb 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Base/PersonBuilder.cs +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Base/PersonBuilder.cs @@ -1,4 +1,5 @@ -using org.ohdsi.cdm.framework.common.Builder; +using Force.DeepCloner; +using org.ohdsi.cdm.framework.common.Builder; using org.ohdsi.cdm.framework.common.Enums; using org.ohdsi.cdm.framework.common.Extensions; using org.ohdsi.cdm.framework.common.Helpers; @@ -1141,80 +1142,134 @@ public void JoinToVocabulary(IVocabulary vocabulary) Vocabulary ??= vocabulary; } - public static void UpdateRSourceConcept(IEnumerable records) + //protected static void AddEntity(T entity, List list) where T : IEntity + public static IEnumerable UpdateRSourceConcept(IEnumerable records) where T : IEntity { + var r = new List(); foreach (var record in records) { - UpdateRSourceConcept(record); - } - } - - // Fix for invalid_reason = 'R' - private static void UpdateRSourceConcept(IEntity e) - { - if (e.SourceConcepts == null) - return; - - var newConceptIds = new List>(); - foreach (var sc in e.SourceConcepts) - { - if (char.ToLower(sc.InvalidReason) != 'r') - continue; - - long newSourceConceptId = 0; - long newConceptId = 0; - - if (sc.ConceptId > 0 && e.StartDate.Between(sc.ValidStartDate, sc.ValidEndDate)) + if (record.SourceConcepts != null && record.SourceConcepts.Any(r => char.ToLower(r.InvalidReason) == 'r')) { - newSourceConceptId = sc.ConceptId; + r.Add(record); } - - if (e.ConceptId > 0 && e.StartDate.Between(e.ValidStartDate, e.ValidEndDate)) - { - newConceptId = e.ConceptId; - } - - newConceptIds.Add(new Tuple(newSourceConceptId, newConceptId)); + else + yield return record; } - if (newConceptIds.Count > 0) + if (r.Count > 1) { - Tuple newMap = null; - // SourceConceptId - var r1 = newConceptIds.Where(c => c.Item1 > 0); - - if (r1.Any()) - { - // ConceptId - var r2 = r1.Where(c => c.Item2 > 0); - if (r2.Any()) - { - newMap = r2.FirstOrDefault(); - } - } - else + foreach (var byGuid in r.GroupBy(i => i.SourceRecordGuid)) { - var r2 = newConceptIds.Where(c => c.Item2 > 0); - if (r2.Any()) + foreach (var bySource in byGuid.GroupBy(i => i.SourceValue)) { - newMap = r2.FirstOrDefault(); - } - } + foreach (var byStartDate in bySource.GroupBy(i => i.StartDate)) + { + var e = byStartDate.First(); + long newSourceConceptId = 0; + long newConceptId = 0; - newMap ??= r1.FirstOrDefault(); + foreach (var sc in e.SourceConcepts) + { + if (char.ToLower(sc.InvalidReason) != 'r') + continue; + + if (e.StartDate.Between(sc.ValidStartDate, sc.ValidEndDate)) + { + newSourceConceptId = sc.ConceptId; + } + + if (e.StartDate.Between(e.ValidStartDate, e.ValidEndDate)) + { + newConceptId = e.ConceptId; + } + } - if (newMap != null) - { - e.SourceConceptId = newMap.Item1; - e.ConceptId = newMap.Item2; - } - else - { - e.SourceConceptId = 0; - e.ConceptId = 0; + if (e.ConceptId != newConceptId || e.SourceConceptId != newSourceConceptId) + { + e.ConceptId = newConceptId; + e.SourceConceptId = newSourceConceptId; + } + + yield return e; + + if (e.SourceConcepts.Count != byStartDate.Count()) + { + + } + } + } } } } + + // Fix for invalid_reason = 'R' + //private static bool UpdateRSourceConcept(IEntity e) + //{ + // if (e.SourceConcepts == null) + // return false; + + // var newConceptIds = new List>(); + // foreach (var sc in e.SourceConcepts) + // { + // if (char.ToLower(sc.InvalidReason) != 'r') + // continue; + + // long newSourceConceptId = 0; + // long newConceptId = 0; + + // if (sc.ConceptId > 0 && e.StartDate.Between(sc.ValidStartDate, sc.ValidEndDate)) + // { + // newSourceConceptId = sc.ConceptId; + // } + + // if (e.ConceptId > 0 && e.StartDate.Between(e.ValidStartDate, e.ValidEndDate)) + // { + // newConceptId = e.ConceptId; + // } + + // newConceptIds.Add(new Tuple(newSourceConceptId, newConceptId)); + // } + + // if (newConceptIds.Count > 0) + // { + // Tuple newMap = null; + // // SourceConceptId + // var r1 = newConceptIds.Where(c => c.Item1 > 0); + + // if (r1.Any()) + // { + // // ConceptId + // var r2 = r1.Where(c => c.Item2 > 0); + // if (r2.Any()) + // { + // newMap = r2.FirstOrDefault(); + // } + // } + // else + // { + // var r2 = newConceptIds.Where(c => c.Item2 > 0); + // if (r2.Any()) + // { + // newMap = r2.FirstOrDefault(); + // } + // } + + // newMap ??= r1.FirstOrDefault(); + + // if (newMap != null) + // { + // e.SourceConceptId = newMap.Item1; + // e.ConceptId = newMap.Item2; + // } + // else + // { + // e.SourceConceptId = 0; + // e.ConceptId = 0; + // } + // } + + // return newConceptIds.Count > 0; + //} #endregion } diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/CPRD/CprdPersonBuilder.cs b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/CPRD/CprdPersonBuilder.cs index d483436c..375d4b0d 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/CPRD/CprdPersonBuilder.cs +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/CPRD/CprdPersonBuilder.cs @@ -413,10 +413,10 @@ public override void AddToChunk(string domain, IEnumerable entities) if (result.Count != 0 && result.Count > 0 && result[0].SourceConcepts.Count > 0 - && result[0].SourceConcepts[0].ConceptId > 0 + && result[0].SourceConcepts.First().ConceptId > 0 /*&& result[0].Domain == "Measurement"*/) { - mes.SourceConceptId = result[0].SourceConcepts[0].ConceptId; + mes.SourceConceptId = result[0].SourceConcepts.First().ConceptId; } } @@ -481,9 +481,9 @@ public override void AddToChunk(string domain, IEnumerable entities) if (result.Count != 0 && result.Count > 0 && result[0].SourceConcepts.Count > 0 - && result[0].SourceConcepts[0].ConceptId > 0) + && result[0].SourceConcepts.First().ConceptId > 0) { - obs.SourceConceptId = result[0].SourceConcepts[0].ConceptId; + obs.SourceConceptId = result[0].SourceConcepts.First().ConceptId; } } diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/PremierPersonBuilder.cs b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/PremierPersonBuilder.cs index eaa755b1..8b1b2afa 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/PremierPersonBuilder.cs +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/PremierPersonBuilder.cs @@ -236,23 +236,16 @@ public override Attrition Build(ChunkData data, KeyMasterOffsetManager o) ConditionForEra.Clear(); - UpdateRSourceConcept(drugExposures); - UpdateRSourceConcept(conditionOccurrences); - UpdateRSourceConcept(procedureOccurrences); - UpdateRSourceConcept(observations); - UpdateRSourceConcept(measurements); - UpdateRSourceConcept(deviceExposure); - // push built entities to ChunkBuilder for further save to CDM database AddToChunk(person, death, observationPeriods, payerPlanPeriods, - drugExposures, - conditionOccurrences, - procedureOccurrences, - observations, - measurements, - [.. visitOccurrences.Values], null, [], deviceExposure, + UpdateRSourceConcept(drugExposures).ToArray(), + UpdateRSourceConcept(conditionOccurrences).ToArray(), + UpdateRSourceConcept(procedureOccurrences).ToArray(), + UpdateRSourceConcept(observations).ToArray(), + UpdateRSourceConcept(measurements).ToArray(), + [.. visitOccurrences.Values], null, [], UpdateRSourceConcept(deviceExposure).ToArray(), [], []); var pg = new PregnancyAlgorithm.PregnancyAlgorithm(); diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Definitions/DeathDefinition.cs b/sources/Framework/org.ohdsi.cdm.framework.common3/Definitions/DeathDefinition.cs index d0749045..3b0888f1 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Definitions/DeathDefinition.cs +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Definitions/DeathDefinition.cs @@ -52,7 +52,7 @@ private IEnumerable PopulateDeath(IDataRecord reader, Concept secondary TypeConceptId = field.DefaultTypeId ?? 0, ValidStartDate = lookupValue.ValidStartDate, ValidEndDate = lookupValue.ValidEndDate, - SourceCauseConceptId = lookupValue.SourceConcepts.Count != 0 ? lookupValue.SourceConcepts[0].ConceptId : 0 + SourceCauseConceptId = lookupValue.SourceConcepts.Count != 0 ? lookupValue.SourceConcepts.First().ConceptId : 0 }; break; diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Definitions/EntityDefinition.cs b/sources/Framework/org.ohdsi.cdm.framework.common3/Definitions/EntityDefinition.cs index 0b9c2964..997cd332 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Definitions/EntityDefinition.cs +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Definitions/EntityDefinition.cs @@ -124,7 +124,7 @@ public virtual IEnumerable GetConcepts(Concept concept, IDataRecord rea } // TMP - var sourceConceptId = lookupValue.SourceConcepts.Count != 0 ? lookupValue.SourceConcepts[0].ConceptId : 0; + var sourceConceptId = lookupValue.SourceConcepts.Count != 0 ? lookupValue.SourceConcepts.First().ConceptId : 0; if (!string.IsNullOrEmpty(field.SourceConceptId)) { var scId = reader.GetLong(field.SourceConceptId); @@ -157,7 +157,7 @@ public virtual IEnumerable GetConcepts(Concept concept, IDataRecord rea VocabularySourceValue = lookupValue.SourceCode, Ingredients = ingredients, ValueAsConceptId = lookupValue.ValueAsConceptId, - SourceConcepts = lookupValue.SourceConcepts, + SourceConcepts = lookupValue.SourceConcepts.ToList(), }; } diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Definitions/ProviderDefinition.cs b/sources/Framework/org.ohdsi.cdm.framework.common3/Definitions/ProviderDefinition.cs index ef839dc4..4e903842 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Definitions/ProviderDefinition.cs +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Definitions/ProviderDefinition.cs @@ -97,8 +97,8 @@ public override IEnumerable GetConcepts(Concept concept, IDataRecord re if (specialtyConceptIds[0].ConceptId != 0) specialtyConcept = specialtyConceptIds[0].ConceptId; - if (specialtyConceptIds[0].SourceConcepts.Count > 0 && specialtyConceptIds[0].SourceConcepts[0].ConceptId != 0) - specialtySourceConceptId = specialtyConceptIds[0].SourceConcepts[0].ConceptId; + if (specialtyConceptIds[0].SourceConcepts.Count > 0 && specialtyConceptIds[0].SourceConcepts.First().ConceptId != 0) + specialtySourceConceptId = specialtyConceptIds[0].SourceConcepts.First().ConceptId; } var prov = new Provider diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Lookups/LookupValue.cs b/sources/Framework/org.ohdsi.cdm.framework.common3/Lookups/LookupValue.cs index 6b14b744..d4f97867 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Lookups/LookupValue.cs +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Lookups/LookupValue.cs @@ -1,4 +1,5 @@ -using System; +using org.ohdsi.cdm.framework.common.Omop; +using System; using System.Collections.Generic; namespace org.ohdsi.cdm.framework.common.Lookups @@ -20,7 +21,10 @@ public bool Equals(SourceConcepts other) public override int GetHashCode() { - return base.GetHashCode(); + return ConceptId.GetHashCode() ^ + (ValidStartDate.GetHashCode()) ^ + (ValidEndDate.GetHashCode()) ^ + InvalidReason.GetHashCode(); } } @@ -32,7 +36,7 @@ public class LookupValue : IEquatable public DateTime ValidStartDate { get; set; } public DateTime ValidEndDate { get; set; } - public List SourceConcepts { get; set; } = []; + public HashSet SourceConcepts { get; set; } = []; public HashSet Ingredients { get; set; } public long? ValueAsConceptId { get; set; } From 5af6122244868ccc49ec0392ef202b898ea65390 Mon Sep 17 00:00:00 2001 From: Anton Ivanov Date: Tue, 28 May 2024 18:25:08 +0300 Subject: [PATCH 10/13] Update PersonBuilder.cs --- .../Base/PersonBuilder.cs | 73 +------------------ 1 file changed, 3 insertions(+), 70 deletions(-) diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Base/PersonBuilder.cs b/sources/Framework/org.ohdsi.cdm.framework.common3/Base/PersonBuilder.cs index 8e7243eb..bec4894c 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Base/PersonBuilder.cs +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Base/PersonBuilder.cs @@ -1164,7 +1164,9 @@ public static IEnumerable UpdateRSourceConcept(IEnumerable records) whe { foreach (var byStartDate in bySource.GroupBy(i => i.StartDate)) { - var e = byStartDate.First(); + var e = byStartDate.Where(i => i.StartDate.Between(i.ValidStartDate, i.ValidEndDate)).FirstOrDefault(); + e ??= byStartDate.First(); + long newSourceConceptId = 0; long newConceptId = 0; @@ -1201,75 +1203,6 @@ public static IEnumerable UpdateRSourceConcept(IEnumerable records) whe } } } - - // Fix for invalid_reason = 'R' - //private static bool UpdateRSourceConcept(IEntity e) - //{ - // if (e.SourceConcepts == null) - // return false; - - // var newConceptIds = new List>(); - // foreach (var sc in e.SourceConcepts) - // { - // if (char.ToLower(sc.InvalidReason) != 'r') - // continue; - - // long newSourceConceptId = 0; - // long newConceptId = 0; - - // if (sc.ConceptId > 0 && e.StartDate.Between(sc.ValidStartDate, sc.ValidEndDate)) - // { - // newSourceConceptId = sc.ConceptId; - // } - - // if (e.ConceptId > 0 && e.StartDate.Between(e.ValidStartDate, e.ValidEndDate)) - // { - // newConceptId = e.ConceptId; - // } - - // newConceptIds.Add(new Tuple(newSourceConceptId, newConceptId)); - // } - - // if (newConceptIds.Count > 0) - // { - // Tuple newMap = null; - // // SourceConceptId - // var r1 = newConceptIds.Where(c => c.Item1 > 0); - - // if (r1.Any()) - // { - // // ConceptId - // var r2 = r1.Where(c => c.Item2 > 0); - // if (r2.Any()) - // { - // newMap = r2.FirstOrDefault(); - // } - // } - // else - // { - // var r2 = newConceptIds.Where(c => c.Item2 > 0); - // if (r2.Any()) - // { - // newMap = r2.FirstOrDefault(); - // } - // } - - // newMap ??= r1.FirstOrDefault(); - - // if (newMap != null) - // { - // e.SourceConceptId = newMap.Item1; - // e.ConceptId = newMap.Item2; - // } - // else - // { - // e.SourceConceptId = 0; - // e.ConceptId = 0; - // } - // } - - // return newConceptIds.Count > 0; - //} #endregion } From 4cc811d4b8f21b9eb6499a83fddfa035d7983e36 Mon Sep 17 00:00:00 2001 From: Anton Ivanov Date: Thu, 30 May 2024 17:29:43 +0300 Subject: [PATCH 11/13] Update Batch.sql --- .../Core/Transformation/Premier/Batch.sql | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql index a9c914b1..33d2aa2b 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql @@ -1,6 +1,4 @@ -SELECT DISTINCT medrec_key, medrec_key +SELECT DISTINCT {0} medrec_key, medrec_key FROM {sc}.pat -JOIN {sc}.patcpt cpt ON PAT.PAT_KEY = cpt.pat_key -where cpt.cpt_code in ('J1440', 'J9350', 'J9380', 'Q2040', 'Q2041', 'Q2042') -order by 1 -limit 1000000 \ No newline at end of file +WHERE medrec_key is not NULL +order by 1 \ No newline at end of file From 963ed16057d943aca364be95b465e6acdd503465 Mon Sep 17 00:00:00 2001 From: Anton Ivanov Date: Thu, 30 May 2024 18:34:46 +0300 Subject: [PATCH 12/13] Update Batch.sql --- .../Core/Transformation/Premier/Batch.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql index 33d2aa2b..09f7e1c7 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Premier/Batch.sql @@ -1,4 +1,4 @@ -SELECT DISTINCT {0} medrec_key, medrec_key +SELECT DISTINCT {0} medrec_key, medrec_key FROM {sc}.pat WHERE medrec_key is not NULL order by 1 \ No newline at end of file From d99992deb7cdd9bd43615dbe80217e3c691b3b26 Mon Sep 17 00:00:00 2001 From: Anton Ivanov Date: Wed, 12 Jun 2024 10:39:25 +0300 Subject: [PATCH 13/13] added to other vendors --- .../HealthVerity/HealthVerityPersonBuilder.cs | 17 +++++++++++------ .../HealthVerity/Lookups/procedure.sql | 4 ++-- .../OptumExtended/Lookups/Procedure.sql | 4 ++-- .../OptumExtended/Lookups/ProcedureICD10.sql | 4 ++-- .../OptumExtended/Lookups/ProcedureICD9.sql | 4 ++-- .../OptumExtendedPersonBuilder.cs | 12 ++++++------ .../Lookups/ConditionFromProcedure.sql | 4 ++-- .../OptumPanther/OptumOncologyPersonBuilder.cs | 18 +++++++++++++++--- .../Truven/Lookups/Procedure.sql | 4 ++-- .../Truven/TruvenPersonBuilder.cs | 14 +++++++++----- .../org.ohdsi.cdm.framework.common.csproj | 4 ++-- .../org.ohdsi.cdm.framework.desktop.csproj | 2 +- .../org.ohdsi.cdm.presentation.etl.csproj | 2 +- 13 files changed, 57 insertions(+), 36 deletions(-) diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/HealthVerity/HealthVerityPersonBuilder.cs b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/HealthVerity/HealthVerityPersonBuilder.cs index 160ccc83..964c0479 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/HealthVerity/HealthVerityPersonBuilder.cs +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/HealthVerity/HealthVerityPersonBuilder.cs @@ -644,12 +644,17 @@ public override Attrition Build(ChunkData data, KeyMasterOffsetManager o) AddToChunk(person, null, observationPeriods, [], - drugExposures, - conditionOccurrences, - procedureOccurrences, - observations, - measurements, - [.. visitOccurrences.Values], visitDetails, [], deviceExposure, [], []); + UpdateRSourceConcept(drugExposures).ToArray(), + UpdateRSourceConcept(conditionOccurrences).ToArray(), + UpdateRSourceConcept(procedureOccurrences).ToArray(), + UpdateRSourceConcept(observations).ToArray(), + UpdateRSourceConcept(measurements).ToArray(), + [.. visitOccurrences.Values], + visitDetails, + [], + UpdateRSourceConcept(deviceExposure).ToArray(), + [], + []); Complete = true; diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/HealthVerity/Lookups/procedure.sql b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/HealthVerity/Lookups/procedure.sql index e0345c3c..bec3c2ff 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/HealthVerity/Lookups/procedure.sql +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/HealthVerity/Lookups/procedure.sql @@ -8,7 +8,7 @@ AND lower(TARGET_STANDARD_CONCEPT) = 's' AND (TARGET_INVALID_REASON IS NULL or TARGET_INVALID_REASON = '') ), Source as ( -SELECT distinct SOURCE_CODE, TARGET_CONCEPT_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE +SELECT distinct SOURCE_CODE, TARGET_CONCEPT_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE, SOURCE_INVALID_REASON FROM Source_to_Source WHERE lower(SOURCE_VOCABULARY_ID) IN ('hcpcs','cpt4', 'icd10pcs', 'cdt') AND lower(TARGET_VOCABULARY_ID) IN ('hcpcs','cpt4', 'icd10pcs', 'cdt') @@ -19,7 +19,7 @@ union select SOURCE_CODE from Source ) -select distinct S_S.SOURCE_CODE, Standard.TARGET_CONCEPT_ID, Standard.TARGET_DOMAIN_ID, Standard.VALID_START_DATE, Standard.VALID_END_DATE, Standard.SOURCE_VOCABULARY_ID, Source.TARGET_CONCEPT_ID as SOURCE_TARGET_CONCEPT_ID, Source.SOURCE_VALID_START_DATE as SOURCE_VALID_START_DATE, Source.SOURCE_VALID_END_DATE, ingredient_level.ingredient_concept_id, Standard.TARGET_VALUE_AS_CONCEPT_ID +select distinct S_S.SOURCE_CODE, Standard.TARGET_CONCEPT_ID, Standard.TARGET_DOMAIN_ID, Standard.VALID_START_DATE, Standard.VALID_END_DATE, Standard.SOURCE_VOCABULARY_ID, Source.TARGET_CONCEPT_ID as SOURCE_TARGET_CONCEPT_ID, Source.SOURCE_VALID_START_DATE as SOURCE_VALID_START_DATE, Source.SOURCE_VALID_END_DATE, ingredient_level.ingredient_concept_id, Standard.TARGET_VALUE_AS_CONCEPT_ID, Source.SOURCE_INVALID_REASON from S_S left join Standard on Standard.SOURCE_CODE = S_S.SOURCE_CODE left join Source on Source.SOURCE_CODE = S_S.SOURCE_CODE diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/OptumExtended/Lookups/Procedure.sql b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/OptumExtended/Lookups/Procedure.sql index 527bcc0f..f51a2b0f 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/OptumExtended/Lookups/Procedure.sql +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/OptumExtended/Lookups/Procedure.sql @@ -8,7 +8,7 @@ AND lower(TARGET_STANDARD_CONCEPT) = 's' AND (TARGET_INVALID_REASON IS NULL or TARGET_INVALID_REASON = '') AND lower(TARGET_CONCEPT_CLASS_ID) NOT IN ('hcpcs modifier','cpt4 modifier','icd10pcs hierarchy') ), Source as ( -SELECT distinct SOURCE_CODE, TARGET_CONCEPT_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE +SELECT distinct SOURCE_CODE, TARGET_CONCEPT_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE, SOURCE_INVALID_REASON FROM Source_to_Source WHERE lower(SOURCE_VOCABULARY_ID) IN ('hcpcs','cpt4', 'icd9proc','icd10pcs') AND lower(TARGET_VOCABULARY_ID) IN ('hcpcs','cpt4', 'icd9proc','icd10pcs') @@ -20,7 +20,7 @@ union select SOURCE_CODE from Source ) -select distinct S_S.SOURCE_CODE, Standard.TARGET_CONCEPT_ID, Standard.TARGET_DOMAIN_ID, Standard.VALID_START_DATE, Standard.VALID_END_DATE, Standard.SOURCE_VOCABULARY_ID, Source.TARGET_CONCEPT_ID as SOURCE_TARGET_CONCEPT_ID, Source.SOURCE_VALID_START_DATE as SOURCE_VALID_START_DATE, Source.SOURCE_VALID_END_DATE, ingredient_level.ingredient_concept_id, Standard.TARGET_VALUE_AS_CONCEPT_ID +select distinct S_S.SOURCE_CODE, Standard.TARGET_CONCEPT_ID, Standard.TARGET_DOMAIN_ID, Standard.VALID_START_DATE, Standard.VALID_END_DATE, Standard.SOURCE_VOCABULARY_ID, Source.TARGET_CONCEPT_ID as SOURCE_TARGET_CONCEPT_ID, Source.SOURCE_VALID_START_DATE as SOURCE_VALID_START_DATE, Source.SOURCE_VALID_END_DATE, ingredient_level.ingredient_concept_id, Standard.TARGET_VALUE_AS_CONCEPT_ID, Source.SOURCE_INVALID_REASON from S_S left join Standard on Standard.SOURCE_CODE = S_S.SOURCE_CODE left join Source on Source.SOURCE_CODE = S_S.SOURCE_CODE diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/OptumExtended/Lookups/ProcedureICD10.sql b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/OptumExtended/Lookups/ProcedureICD10.sql index 0ae2885e..922d4986 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/OptumExtended/Lookups/ProcedureICD10.sql +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/OptumExtended/Lookups/ProcedureICD10.sql @@ -8,7 +8,7 @@ AND lower(TARGET_STANDARD_CONCEPT) = 's' AND (TARGET_INVALID_REASON IS NULL or TARGET_INVALID_REASON = '') AND lower(TARGET_CONCEPT_CLASS_ID) NOT IN ('hcpcs modifier','cpt4 modifier', 'icd10pcs hierarchy') ), Source as ( -SELECT distinct REPLACE(SOURCE_CODE, '.', '') as SOURCE_CODE, TARGET_CONCEPT_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE +SELECT distinct REPLACE(SOURCE_CODE, '.', '') as SOURCE_CODE, TARGET_CONCEPT_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE, SOURCE_INVALID_REASON FROM Source_to_Source WHERE lower(SOURCE_VOCABULARY_ID) IN ('icd10pcs','hcpcs','cpt4') AND lower(TARGET_VOCABULARY_ID) IN ('icd10pcs','hcpcs','cpt4') @@ -20,7 +20,7 @@ union select SOURCE_CODE from Source ) -select distinct S_S.SOURCE_CODE, Standard.TARGET_CONCEPT_ID, Standard.TARGET_DOMAIN_ID, Standard.VALID_START_DATE, Standard.VALID_END_DATE, Standard.SOURCE_VOCABULARY_ID, Source.TARGET_CONCEPT_ID as SOURCE_TARGET_CONCEPT_ID, Source.SOURCE_VALID_START_DATE as SOURCE_VALID_START_DATE, Source.SOURCE_VALID_END_DATE, ingredient_level.ingredient_concept_id, Standard.TARGET_VALUE_AS_CONCEPT_ID +select distinct S_S.SOURCE_CODE, Standard.TARGET_CONCEPT_ID, Standard.TARGET_DOMAIN_ID, Standard.VALID_START_DATE, Standard.VALID_END_DATE, Standard.SOURCE_VOCABULARY_ID, Source.TARGET_CONCEPT_ID as SOURCE_TARGET_CONCEPT_ID, Source.SOURCE_VALID_START_DATE as SOURCE_VALID_START_DATE, Source.SOURCE_VALID_END_DATE, ingredient_level.ingredient_concept_id, Standard.TARGET_VALUE_AS_CONCEPT_ID, Source.SOURCE_INVALID_REASON from S_S left join Standard on Standard.SOURCE_CODE = S_S.SOURCE_CODE left join Source on Source.SOURCE_CODE = S_S.SOURCE_CODE diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/OptumExtended/Lookups/ProcedureICD9.sql b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/OptumExtended/Lookups/ProcedureICD9.sql index b89b25f2..09dc0682 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/OptumExtended/Lookups/ProcedureICD9.sql +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/OptumExtended/Lookups/ProcedureICD9.sql @@ -8,7 +8,7 @@ AND lower(TARGET_STANDARD_CONCEPT) = 's' AND (TARGET_INVALID_REASON IS NULL or TARGET_INVALID_REASON = '') AND lower(TARGET_CONCEPT_CLASS_ID) NOT IN ('hcpcs modifier','cpt4 modifier') ), Source as ( -SELECT distinct REPLACE(SOURCE_CODE, '.', '') as SOURCE_CODE, TARGET_CONCEPT_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE +SELECT distinct REPLACE(SOURCE_CODE, '.', '') as SOURCE_CODE, TARGET_CONCEPT_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE, SOURCE_INVALID_REASON FROM Source_to_Source WHERE lower(SOURCE_VOCABULARY_ID) IN ('icd9proc','hcpcs','cpt4') AND lower(TARGET_VOCABULARY_ID) IN ('icd9proc','hcpcs','cpt4') @@ -20,7 +20,7 @@ union select SOURCE_CODE from Source ) -select distinct S_S.SOURCE_CODE, Standard.TARGET_CONCEPT_ID, Standard.TARGET_DOMAIN_ID, Standard.VALID_START_DATE, Standard.VALID_END_DATE, Standard.SOURCE_VOCABULARY_ID, Source.TARGET_CONCEPT_ID as SOURCE_TARGET_CONCEPT_ID, Source.SOURCE_VALID_START_DATE as SOURCE_VALID_START_DATE, Source.SOURCE_VALID_END_DATE, ingredient_level.ingredient_concept_id, Standard.TARGET_VALUE_AS_CONCEPT_ID +select distinct S_S.SOURCE_CODE, Standard.TARGET_CONCEPT_ID, Standard.TARGET_DOMAIN_ID, Standard.VALID_START_DATE, Standard.VALID_END_DATE, Standard.SOURCE_VOCABULARY_ID, Source.TARGET_CONCEPT_ID as SOURCE_TARGET_CONCEPT_ID, Source.SOURCE_VALID_START_DATE as SOURCE_VALID_START_DATE, Source.SOURCE_VALID_END_DATE, ingredient_level.ingredient_concept_id, Standard.TARGET_VALUE_AS_CONCEPT_ID, Source.SOURCE_INVALID_REASON from S_S left join Standard on Standard.SOURCE_CODE = S_S.SOURCE_CODE left join Source on Source.SOURCE_CODE = S_S.SOURCE_CODE diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/OptumExtended/OptumExtendedPersonBuilder.cs b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/OptumExtended/OptumExtendedPersonBuilder.cs index 90d9d538..6fc2b99f 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/OptumExtended/OptumExtendedPersonBuilder.cs +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/OptumExtended/OptumExtendedPersonBuilder.cs @@ -760,15 +760,15 @@ public override Attrition Build(ChunkData data, KeyMasterOffsetManager o) death, observationPeriods, payerPlanPeriods, - Clean(drugExposures, person).ToArray(), - Clean(conditionOccurrences, person).ToArray(), - Clean(procedureOccurrences, person).ToArray(), - Clean(observations, person).ToArray(), - Clean(measurements, person).ToArray(), + UpdateRSourceConcept(Clean(drugExposures, person)).ToArray(), + UpdateRSourceConcept(Clean(conditionOccurrences, person)).ToArray(), + UpdateRSourceConcept(Clean(procedureOccurrences, person)).ToArray(), + UpdateRSourceConcept(Clean(observations, person)).ToArray(), + UpdateRSourceConcept(Clean(measurements, person)).ToArray(), vos, [.. vds.Values], [], - Clean(deviceExposure, person).ToArray(), + UpdateRSourceConcept(Clean(deviceExposure, person)).ToArray(), [], []); diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/OptumPanther/Lookups/ConditionFromProcedure.sql b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/OptumPanther/Lookups/ConditionFromProcedure.sql index 39bd070e..a6a4fcd6 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/OptumPanther/Lookups/ConditionFromProcedure.sql +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/OptumPanther/Lookups/ConditionFromProcedure.sql @@ -7,7 +7,7 @@ AND (lower(TARGET_STANDARD_CONCEPT) = 's') AND (TARGET_INVALID_REASON IS NULL or TARGET_INVALID_REASON = '') ), Source as ( -SELECT distinct REPLACE(SOURCE_CODE, '.', '') AS SOURCE_CODE, TARGET_CONCEPT_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE +SELECT distinct REPLACE(SOURCE_CODE, '.', '') AS SOURCE_CODE, TARGET_CONCEPT_ID, SOURCE_VALID_START_DATE, SOURCE_VALID_END_DATE, SOURCE_INVALID_REASON FROM Source_to_Source WHERE lower(SOURCE_VOCABULARY_ID) IN ('hcpcs','cpt4', 'icd10pcs') AND lower(TARGET_VOCABULARY_ID) IN ('hcpcs','cpt4', 'icd10pcs') @@ -18,7 +18,7 @@ union select SOURCE_CODE from Source ) -select distinct S_S.SOURCE_CODE, Standard.TARGET_CONCEPT_ID, Standard.TARGET_DOMAIN_ID, Standard.VALID_START_DATE, Standard.VALID_END_DATE, Standard.SOURCE_VOCABULARY_ID, Source.TARGET_CONCEPT_ID as SOURCE_TARGET_CONCEPT_ID, Source.SOURCE_VALID_START_DATE as SOURCE_VALID_START_DATE, Source.SOURCE_VALID_END_DATE, ingredient_level.ingredient_concept_id, Standard.TARGET_VALUE_AS_CONCEPT_ID +select distinct S_S.SOURCE_CODE, Standard.TARGET_CONCEPT_ID, Standard.TARGET_DOMAIN_ID, Standard.VALID_START_DATE, Standard.VALID_END_DATE, Standard.SOURCE_VOCABULARY_ID, Source.TARGET_CONCEPT_ID as SOURCE_TARGET_CONCEPT_ID, Source.SOURCE_VALID_START_DATE as SOURCE_VALID_START_DATE, Source.SOURCE_VALID_END_DATE, ingredient_level.ingredient_concept_id, Standard.TARGET_VALUE_AS_CONCEPT_ID, Source.SOURCE_INVALID_REASON from S_S left join Standard on Standard.SOURCE_CODE = S_S.SOURCE_CODE left join Source on Source.SOURCE_CODE = S_S.SOURCE_CODE diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/OptumPanther/OptumOncologyPersonBuilder.cs b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/OptumPanther/OptumOncologyPersonBuilder.cs index 6c0bc072..af99903b 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/OptumPanther/OptumOncologyPersonBuilder.cs +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/OptumPanther/OptumOncologyPersonBuilder.cs @@ -1058,9 +1058,21 @@ public override Attrition Build(ChunkData data, KeyMasterOffsetManager om) } // push built entities to ChunkBuilder for further save to CDM database - AddToChunk(person, death, [.. observationPeriodsFinal], payerPlanPeriods, drugExposures, - conditionOccurrences, procedureOccurrences, observations, measurements, - [.. visitOccurrences.Values], [.. visitDetails.Values], cohort, deviceExposure, notes, episodes); + AddToChunk(person, + death, + [.. observationPeriodsFinal], + payerPlanPeriods, + UpdateRSourceConcept(drugExposures).ToArray(), + UpdateRSourceConcept(conditionOccurrences).ToArray(), + UpdateRSourceConcept(procedureOccurrences).ToArray(), + UpdateRSourceConcept(observations).ToArray(), + UpdateRSourceConcept(measurements).ToArray(), + [.. visitOccurrences.Values], + [.. visitDetails.Values], + cohort, + UpdateRSourceConcept(deviceExposure).ToArray(), + notes, + episodes); var pg = new PregnancyAlgorithm.PregnancyAlgorithm(); foreach (var r in pg.GetPregnancyEpisodes(Vocabulary, person, [.. observationPeriodsFinal], diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Truven/Lookups/Procedure.sql b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Truven/Lookups/Procedure.sql index 0c1dc0ce..8abf486f 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Truven/Lookups/Procedure.sql +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Truven/Lookups/Procedure.sql @@ -7,7 +7,7 @@ AND (TARGET_STANDARD_CONCEPT IS NOT NULL or TARGET_STANDARD_CONCEPT != '') AND (TARGET_INVALID_REASON IS NULL or TARGET_INVALID_REASON = '') AND lower(TARGET_CONCEPT_CLASS_ID) NOT IN ('hcpcs modifier','cpt4 modifier','cpt4 hierarchy','icd10pcs hierarchy') ), Source as ( -SELECT distinct REPLACE(SOURCE_CODE, '.', '') AS SOURCE_CODE, TARGET_CONCEPT_ID, TARGET_DOMAIN_ID +SELECT distinct REPLACE(SOURCE_CODE, '.', '') AS SOURCE_CODE, TARGET_CONCEPT_ID, TARGET_DOMAIN_ID, SOURCE_INVALID_REASON FROM Source_to_Source WHERE lower(SOURCE_VOCABULARY_ID) IN ('icd9proc','hcpcs','cpt4','icd10pcs', 'cdt') AND lower(TARGET_VOCABULARY_ID) IN ('icd9proc','hcpcs','cpt4','icd10pcs', 'cdt') @@ -19,7 +19,7 @@ union select SOURCE_CODE from Source ) -select distinct S_S.SOURCE_CODE, Standard.TARGET_CONCEPT_ID, Standard.TARGET_DOMAIN_ID, Standard.VALID_START_DATE, Standard.VALID_END_DATE, Standard.SOURCE_VOCABULARY_ID, Source.TARGET_CONCEPT_ID as SOURCE_TARGET_CONCEPT_ID, cast('1900/1/1' as date) as SOURCE_validStartDate, cast('2100/1/1' as date) as SOURCE_validEndDate, ingredient_level.ingredient_concept_id, Standard.TARGET_VALUE_AS_CONCEPT_ID +select distinct S_S.SOURCE_CODE, Standard.TARGET_CONCEPT_ID, Standard.TARGET_DOMAIN_ID, Standard.VALID_START_DATE, Standard.VALID_END_DATE, Standard.SOURCE_VOCABULARY_ID, Source.TARGET_CONCEPT_ID as SOURCE_TARGET_CONCEPT_ID, cast('1900/1/1' as date) as SOURCE_validStartDate, cast('2100/1/1' as date) as SOURCE_validEndDate, ingredient_level.ingredient_concept_id, Standard.TARGET_VALUE_AS_CONCEPT_ID, Source.SOURCE_INVALID_REASON from S_S left join Standard on Standard.SOURCE_CODE = S_S.SOURCE_CODE left join Source on Source.SOURCE_CODE = S_S.SOURCE_CODE diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Truven/TruvenPersonBuilder.cs b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Truven/TruvenPersonBuilder.cs index 9c9bea4c..27202457 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Truven/TruvenPersonBuilder.cs +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/Core/Transformation/Truven/TruvenPersonBuilder.cs @@ -759,11 +759,15 @@ public override Attrition Build(ChunkData data, KeyMasterOffsetManager o) observationPeriods, payerPlanPeriods, [.. drugExposures], - conditionOccurrences, - procedureOccurrences, - observations, - measurements, - visitOccurrences, [.. visitDetails], [], deviceExposure, []); + UpdateRSourceConcept(conditionOccurrences).ToArray(), + UpdateRSourceConcept(procedureOccurrences).ToArray(), + UpdateRSourceConcept(observations).ToArray(), + UpdateRSourceConcept(measurements).ToArray(), + visitOccurrences, + [.. visitDetails], + [], + UpdateRSourceConcept(deviceExposure).ToArray(), + []); Complete = true; diff --git a/sources/Framework/org.ohdsi.cdm.framework.common3/org.ohdsi.cdm.framework.common.csproj b/sources/Framework/org.ohdsi.cdm.framework.common3/org.ohdsi.cdm.framework.common.csproj index 961f726d..5b8b2dae 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.common3/org.ohdsi.cdm.framework.common.csproj +++ b/sources/Framework/org.ohdsi.cdm.framework.common3/org.ohdsi.cdm.framework.common.csproj @@ -1809,8 +1809,8 @@ - - + + diff --git a/sources/Framework/org.ohdsi.cdm.framework.desktop3/org.ohdsi.cdm.framework.desktop.csproj b/sources/Framework/org.ohdsi.cdm.framework.desktop3/org.ohdsi.cdm.framework.desktop.csproj index 665e5bc2..eb3a5487 100644 --- a/sources/Framework/org.ohdsi.cdm.framework.desktop3/org.ohdsi.cdm.framework.desktop.csproj +++ b/sources/Framework/org.ohdsi.cdm.framework.desktop3/org.ohdsi.cdm.framework.desktop.csproj @@ -6,7 +6,7 @@ - + diff --git a/sources/Presentation/org.ohdsi.cdm.presentation.etl2/org.ohdsi.cdm.presentation.etl.csproj b/sources/Presentation/org.ohdsi.cdm.presentation.etl2/org.ohdsi.cdm.presentation.etl.csproj index 6e53881b..806e3e20 100644 --- a/sources/Presentation/org.ohdsi.cdm.presentation.etl2/org.ohdsi.cdm.presentation.etl.csproj +++ b/sources/Presentation/org.ohdsi.cdm.presentation.etl2/org.ohdsi.cdm.presentation.etl.csproj @@ -22,7 +22,7 @@ - +