-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimized SQL for fetching related standard concepts, eliminated vend…
…or-specific string aggregating function
- Loading branch information
1 parent
893fe01
commit 932b733
Showing
3 changed files
with
78 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
.../resources/resources/vocabulary/sql/getRelatedStandardMappedConcepts_getMappedFromIds.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
SELECT | ||
c.CONCEPT_ID, | ||
c.MAPPED_FROM_ID | ||
FROM ( | ||
SELECT DISTINCT | ||
c.CONCEPT_ID, | ||
CAST(cr.CONCEPT_ID_1 AS VARCHAR) as MAPPED_FROM_ID | ||
FROM | ||
@CDM_schema.concept_relationship cr | ||
JOIN | ||
@CDM_schema.concept c ON cr.CONCEPT_ID_2 = c.CONCEPT_ID | ||
JOIN | ||
@CDM_schema.relationship r ON cr.RELATIONSHIP_ID = r.RELATIONSHIP_ID | ||
WHERE | ||
cr.CONCEPT_ID_1 IN (@conceptIdList) | ||
AND COALESCE(c.STANDARD_CONCEPT, 'N') IN ('S', 'C') | ||
AND cr.INVALID_REASON IS NULL | ||
) c | ||
ORDER BY | ||
c.CONCEPT_ID; |