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/i2b2_facts_prune.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: 973 bytes
Line 
1/* i2b2_facts_prune.sql - Delete identified facts from failed load tasks.
2
3Copyright (c) 2012 University of Kansas Medical Center
4part of the HERON* open source codebase; see NOTICE file for license details.
5* http://informatics.kumc.edu/work/wiki/HERON
6
7*/
8
9-- set star=NIGHTHERONDATA
10
11whenever sqlerror continue; -- in case index is already there
12CREATE INDEX "&&star".observation_fact_upload_id
13  ON "&&star".observation_fact (upload_id);
14whenever sqlerror exit;
15
16delete from "&&star".observation_fact
17where upload_id in (
18  select upload_id from "&&star".upload_status
19  where load_status is null);
20
21drop index "&&star".observation_fact_upload_id;
22
23
24/* Compare observation_facts contents with upload_status summary
25
26select f.*, us.* from
27(select count(*) facts, f.upload_id
28from BlueHeronData.observation_fact f
29group by f.upload_id) f
30left join BlueHeronData.upload_status us
31  on us.upload_id = f.upload_id
32order by f.upload_id;
33-- cost 760684
34-- 406.635 seconds
35*/
Note: See TracBrowser for help on using the repository browser.