Skip to content

Instantly share code, notes, and snippets.

@callahantiff
Last active April 9, 2019 04:23
Show Gist options
  • Save callahantiff/2e9558064f62c29cbad5a75b684ae175 to your computer and use it in GitHub Desktop.
Save callahantiff/2e9558064f62c29cbad5a75b684ae175 to your computer and use it in GitHub Desktop.
PheKnowVec_Source_String_Query
-- Query Template: find OMOP concept codes with a label that partially matches a source string
SELECT
source_string,
CONCAT('"', source_code, '"') AS source_code,
source_name,
source_domain,
source_vocabulary
FROM
(SELECT DISTINCT
concept_code AS source_code,
concept_name AS source_name,
domain_id AS source_domain,
vocabulary_id AS source_vocabulary,
standard_concept,
CASE
{0}
ELSE "NOT A MATCH TO SOURCE STRING"
END AS source_string
FROM CHCO_DeID_Oct2018.concept
WHERE domain_id IN ({1}))
WHERE source_string != "NOT A MATCH TO SOURCE STRING"
ORDER BY source_vocabulary, source_code;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment