Skip to content

Commit

Permalink
core: tighten up core_observation_lab and _vital_signs inclusion
Browse files Browse the repository at this point in the history
Require both these observation sub-type tables to use the proper
category code and system.
  • Loading branch information
mikix committed Apr 17, 2024
1 parent 117ec0f commit cda8965
Show file tree
Hide file tree
Showing 9 changed files with 368 additions and 8,023 deletions.
16 changes: 12 additions & 4 deletions cumulus_library/studies/core/observation_type.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
CREATE TABLE core__observation_lab AS

SELECT
co.id,
co.observation_code,
Expand All @@ -17,7 +16,12 @@ SELECT
co.subject_ref,
co.encounter_ref,
co.observation_ref
FROM core__observation AS co;
FROM
core__observation AS co
WHERE
co.category_code = 'laboratory'
AND co.category_code_system
= 'http://terminology.hl7.org/CodeSystem/observation-category';

CREATE TABLE core__observation_vital_signs AS
SELECT
Expand All @@ -40,5 +44,9 @@ SELECT
co.subject_ref,
co.encounter_ref,
co.observation_ref
FROM core__observation AS co
WHERE co.category_code = 'vital-signs';
FROM
core__observation AS co
WHERE
co.category_code = 'vital-signs'
AND co.category_code_system
= 'http://terminology.hl7.org/CodeSystem/observation-category';
Loading

0 comments on commit cda8965

Please sign in to comment.