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_star_truncate.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.4 KB
Line 
1/* i2b2_star_truncate.sql -- truncate dimensions and facts from i2b2 datamart.
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
7Also set load_status to null for all upload_status records.
8And drop indexes on observation_fact.
9See i2b2_facts_index.sql to put them back.
10
11This is invoked from epic_etl.py, which provides &&star.
12*/
13truncate table &&star.patient_mapping;
14truncate table &&star.encounter_mapping;
15truncate table &&star.patient_dimension;
16truncate table &&star.visit_dimension;
17truncate table &&star.provider_dimension;
18truncate table &&star.observation_fact;
19
20update &&star.upload_status
21  set load_status = null;
22
23-- define star=BLUEHERONDATA
24
25whenever sqlerror continue;
26alter table "&&star".observation_fact
27  nologging;
28alter table "&&star".observation_fact
29  disable constraint observation_fact_pk;
30drop index "&&star".observation_fact_pk;
31
32/* Default i2b2 indexes */
33drop index "&&star".FACT_NOLOB;
34drop index "&&star".FACT_PATCON_DATE_PRVD_IDX;
35drop index "&&star".FACT_CNPT_PAT_ENCT_IDX;
36
37/* Bitmap indexes as per #1069 */
38drop index "&&star".OBS_FACT_ENC_NUM_BI;
39drop index "&&star".OBS_FACT_PAT_NUM_BI;
40drop index "&&star".OBS_FACT_CON_CODE_BI;
41drop index "&&star".OBS_FACT_VALTYP_CD_BI;
42drop index "&&star".OBS_FACT_TVAL_CHAR_BI;
43drop index "&&star".OBS_FACT_NVAL_NUM_BI;
44
45whenever sqlerror exit;
Note: See TracBrowser for help on using the repository browser.