-
Notifications
You must be signed in to change notification settings - Fork 4
/
030_achilles_postgresql_ddl.sql
141 lines (127 loc) · 2.83 KB
/
030_achilles_postgresql_ddl.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
set search_path = demo_cdm_results;
CREATE TABLE achilles_analysis
(
analysis_id integer,
analysis_name text,
stratum_1_name text,
stratum_2_name text,
stratum_3_name text,
stratum_4_name text,
stratum_5_name text,
is_default text,
category text
)
WITH (
OIDS=FALSE
);
ALTER TABLE achilles_analysis
OWNER TO postgres;
CREATE TABLE achilles_heel_results
(
analysis_id integer,
achilles_heel_warning character varying(255),
rule_id integer,
record_count numeric
)
WITH (
OIDS=FALSE
);
ALTER TABLE achilles_heel_results
OWNER TO postgres;
CREATE TABLE achilles_results
(
analysis_id integer,
stratum_1 character varying,
stratum_2 character varying,
stratum_3 character varying,
stratum_4 character varying,
stratum_5 character varying,
count_value bigint
)
WITH (
OIDS=FALSE
);
ALTER TABLE achilles_results
OWNER TO postgres;
CREATE INDEX idx_ar_aid
ON achilles_results
USING btree
(analysis_id);
CREATE INDEX idx_ar_aid_s1
ON achilles_results
USING btree
(analysis_id, stratum_1 COLLATE pg_catalog."default");
CREATE INDEX idx_ar_aid_s1234
ON achilles_results
USING btree
(analysis_id, stratum_1 COLLATE pg_catalog."default", stratum_2 COLLATE pg_catalog."default", stratum_3 COLLATE pg_catalog."default", stratum_4 COLLATE pg_catalog."default");
CREATE INDEX idx_ar_s1
ON achilles_results
USING btree
(stratum_1 COLLATE pg_catalog."default");
CREATE INDEX idx_ar_s2
ON achilles_results
USING btree
(stratum_2 COLLATE pg_catalog."default");
CREATE TABLE achilles_results_derived
(
analysis_id integer,
stratum_1 character varying(255),
stratum_2 character varying(255),
statistic_value numeric,
measure_id character varying
)
WITH (
OIDS=FALSE
);
ALTER TABLE achilles_results_derived
OWNER TO postgres;
CREATE TABLE achilles_results_dist
(
analysis_id integer,
stratum_1 character varying,
stratum_2 character varying,
stratum_3 character varying,
stratum_4 character varying,
stratum_5 character varying,
count_value bigint,
min_value numeric,
max_value numeric,
avg_value numeric,
stdev_value numeric,
median_value numeric,
p10_value numeric,
p25_value numeric,
p75_value numeric,
p90_value numeric
)
WITH (
OIDS=FALSE
);
ALTER TABLE achilles_results_dist
OWNER TO postgres;
CREATE INDEX idx_ard_aid
ON achilles_results_dist
USING btree
(analysis_id);
CREATE INDEX idx_ard_s1
ON achilles_results_dist
USING btree
(stratum_1 COLLATE pg_catalog."default");
CREATE INDEX idx_ard_s2
ON achilles_results_dist
USING btree
(stratum_2 COLLATE pg_catalog."default");
CREATE TABLE achilles_result_concept_count
(
concept_id integer,
record_count numeric,
descendant_record_count numeric,
person_count numeric,
descendant_person_count numeric
)
WITH (
OIDS=FALSE
);
ALTER TABLE achilles_result_concept_count
OWNER TO postgres;