Note: We no longer publish the latest version of our code here. We primarily use a kumc-bmi github organization. The heron ETL repository, in particular, is not public. Peers in the informatics community should see MultiSiteDev for details on requesting access.

source: heron_load/verify_ob_fact_encounter_ide.sql @ 0:42ad7288920a

heron-michigan tip
Last change on this file since 0:42ad7288920a was 0:42ad7288920a, checked in by Matt Hoag <mhoag@…>, 6 years ago

Merge with demo_concepts_3800

File size: 1.5 KB
Line 
1/** verify_ob_fact_encounter_ide ensure that every fact has an associated
2  * sub_encounter in ID and DEID
3
4  * Copyright (c) 2015 University of Kansas Medical Center
5  * part of the HERON open source codebase; see NOTICE file for license details.
6  * http://informatics.kumc.edu/work/wiki/HERON
7  */
8 
9insert into etl_test_values (test_value, test_domain, test_name, result_id
10                           , result_date)
11with test_key as (
12  select 'i2b2' test_domain,
13  'id_encounter_ide_exists' test_name from dual
14  )
15, test_values as (
16  select count(*) test_value, test_key.* from (
17    select distinct sourcesystem_cd
18    from (select * from nightherondata.observation_fact
19          where sub_encounter is null)
20    ), test_key
21  )
22select test_value, test_domain, test_name, sq_result_id.nextval, sysdate
23from test_values
24;
25
26
27insert into etl_test_values (test_value, test_domain, test_name, result_id
28                           , result_date)
29with test_key as (
30  select 'i2b2' test_domain,
31  'deid_encounter_ide_exists' test_name from dual
32  )
33, test_values as (
34  select count(*) test_value, test_key.* from (
35    select distinct sourcesystem_cd
36    from (select encounter_num, patient_num, provider_id, concept_cd
37               , modifier_cd, instance_num, sourcesystem_cd, sub_encounter
38          from blueherondata.observation_fact@deid
39          where sub_encounter is null)
40    ), test_key
41  )
42select test_value, test_domain, test_name, sq_result_id.nextval, sysdate
43from test_values
44;
Note: See TracBrowser for help on using the repository browser.