Skip to content

Commit

Permalink
re-ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
hardhouse committed Jul 27, 2021
1 parent 6f2b4a7 commit 4eaac44
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions working/manual_changes/2021/2021-07-23.sql
Original file line number Diff line number Diff line change
Expand Up @@ -342,17 +342,7 @@ UNION ALL
JOIN relationship r USING (relationship_id)
);

--5. Delete duplicates from synonyms
DELETE
FROM concept_synonym cs
WHERE EXISTS (
SELECT 1
FROM concept c_int
WHERE c_int.concept_id = cs.concept_id
AND LOWER(c_int.concept_name) = LOWER(cs.concept_synonym_name)
);

--6. Clean up concept/synonym names
--5. Clean up concept/synonym names
UPDATE concept c
SET concept_name = REPLACE(REGEXP_REPLACE(c.concept_name, '\s*(/|@)\s*', ' \1 ', 'g'), '(I / T / U)', '(I/T/U)')
WHERE (
Expand Down Expand Up @@ -387,4 +377,15 @@ WHERE cs.concept_id = c.concept_id
'Nebraska Lexicon',
'Read',
'SNOMED'
);


--6. Delete duplicates from synonyms
DELETE
FROM concept_synonym cs
WHERE EXISTS (
SELECT 1
FROM concept c_int
WHERE c_int.concept_id = cs.concept_id
AND LOWER(c_int.concept_name) = LOWER(cs.concept_synonym_name)
);

0 comments on commit 4eaac44

Please sign in to comment.