Revision 13370
Added by Aaron Marcuse-Kubitza almost 11 years ago
trunk/inputs/bien2_traits/validations.sql.run | ||
---|---|---|
1 |
#!/bin/bash -e |
|
2 |
. "$(dirname "${BASH_SOURCE[0]}")"/../../lib/runscripts/validations.pg.sql.run |
|
3 | 0 |
trunk/inputs/bien2_traits/validations.sql | ||
---|---|---|
1 |
-- |
|
2 |
-- PostgreSQL database dump |
|
3 |
-- |
|
4 |
|
|
5 |
SET statement_timeout = 0; |
|
6 |
SET lock_timeout = 0; |
|
7 |
SET client_encoding = 'UTF8'; |
|
8 |
SET standard_conforming_strings = on; |
|
9 |
SET check_function_bodies = false; |
|
10 |
SET client_min_messages = warning; |
|
11 |
|
|
12 |
SET search_path = bien2_traits, pg_catalog; |
|
13 |
|
|
14 |
-- |
|
15 |
-- Name: _traits_01_count_records; Type: VIEW; Schema: bien2_traits; Owner: - |
|
16 |
-- |
|
17 |
|
|
18 |
CREATE VIEW _traits_01_count_records AS |
|
19 |
SELECT count(*) AS "totalRecords" |
|
20 |
FROM "TraitObservation" |
|
21 |
WHERE (((("TraitObservation"."taxonName" IS NOT NULL) AND ("TraitObservation"."taxonName" <> ''::text)) AND ("TraitObservation"."measurementName" IS NOT NULL)) AND ("TraitObservation"."measurementName" <> ''::text)); |
|
22 |
|
|
23 |
|
|
24 |
-- |
|
25 |
-- Name: _traits_02_count_trait_names; Type: VIEW; Schema: bien2_traits; Owner: - |
|
26 |
-- |
|
27 |
|
|
28 |
CREATE VIEW _traits_02_count_trait_names AS |
|
29 |
SELECT count(DISTINCT "TraitObservation"."measurementName") AS traits |
|
30 |
FROM "TraitObservation" |
|
31 |
WHERE (((("TraitObservation"."taxonName" IS NOT NULL) AND ("TraitObservation"."taxonName" <> ''::text)) AND ("TraitObservation"."measurementName" IS NOT NULL)) AND ("TraitObservation"."measurementName" <> ''::text)); |
|
32 |
|
|
33 |
|
|
34 |
-- |
|
35 |
-- Name: _traits_03_list_trait_names; Type: VIEW; Schema: bien2_traits; Owner: - |
|
36 |
-- |
|
37 |
|
|
38 |
CREATE VIEW _traits_03_list_trait_names AS |
|
39 |
SELECT DISTINCT "TraitObservation"."measurementName" AS trait |
|
40 |
FROM "TraitObservation" |
|
41 |
WHERE (((("TraitObservation"."taxonName" IS NOT NULL) AND ("TraitObservation"."taxonName" <> ''::text)) AND ("TraitObservation"."measurementName" IS NOT NULL)) AND ("TraitObservation"."measurementName" <> ''::text)) |
|
42 |
ORDER BY "TraitObservation"."measurementName"; |
|
43 |
|
|
44 |
|
|
45 |
-- |
|
46 |
-- Name: _traits_04_count_records_per_trait; Type: VIEW; Schema: bien2_traits; Owner: - |
|
47 |
-- |
|
48 |
|
|
49 |
CREATE VIEW _traits_04_count_records_per_trait AS |
|
50 |
SELECT "TraitObservation"."measurementName" AS trait, |
|
51 |
count(*) AS measurements |
|
52 |
FROM "TraitObservation" |
|
53 |
WHERE (((("TraitObservation"."taxonName" IS NOT NULL) AND ("TraitObservation"."taxonName" <> ''::text)) AND ("TraitObservation"."measurementName" IS NOT NULL)) AND ("TraitObservation"."measurementName" <> ''::text)) |
|
54 |
GROUP BY "TraitObservation"."measurementName" |
|
55 |
ORDER BY "TraitObservation"."measurementName"; |
|
56 |
|
|
57 |
|
|
58 |
-- |
|
59 |
-- Name: _traits_05_count_taxa; Type: VIEW; Schema: bien2_traits; Owner: - |
|
60 |
-- |
|
61 |
|
|
62 |
CREATE VIEW _traits_05_count_taxa AS |
|
63 |
SELECT count(DISTINCT btrim(concat_ws(' '::text, ifnull("TraitObservation"."taxonName", ''::text), ifnull("TraitObservation"."scientificNameAuthorship", ''::text)))) AS taxa |
|
64 |
FROM "TraitObservation" |
|
65 |
WHERE (((("TraitObservation"."taxonName" IS NOT NULL) AND ("TraitObservation"."taxonName" <> ''::text)) AND ("TraitObservation"."measurementName" IS NOT NULL)) AND ("TraitObservation"."measurementName" <> ''::text)); |
|
66 |
|
|
67 |
|
|
68 |
-- |
|
69 |
-- Name: _traits_06_list_distinct_taxa; Type: VIEW; Schema: bien2_traits; Owner: - |
|
70 |
-- |
|
71 |
|
|
72 |
CREATE VIEW _traits_06_list_distinct_taxa AS |
|
73 |
SELECT DISTINCT btrim(concat_ws(' '::text, ifnull("TraitObservation"."taxonName", ''::text), ifnull("TraitObservation"."scientificNameAuthorship", ''::text))) AS taxonwithauthor |
|
74 |
FROM "TraitObservation" |
|
75 |
WHERE (((("TraitObservation"."taxonName" IS NOT NULL) AND ("TraitObservation"."taxonName" <> ''::text)) AND ("TraitObservation"."measurementName" IS NOT NULL)) AND ("TraitObservation"."measurementName" <> ''::text)) |
|
76 |
ORDER BY btrim(concat_ws(' '::text, ifnull("TraitObservation"."taxonName", ''::text), ifnull("TraitObservation"."scientificNameAuthorship", ''::text))); |
|
77 |
|
|
78 |
|
|
79 |
-- |
|
80 |
-- Name: _traits_07_trait_value_and_units; Type: VIEW; Schema: bien2_traits; Owner: - |
|
81 |
-- |
|
82 |
|
|
83 |
CREATE VIEW _traits_07_trait_value_and_units AS |
|
84 |
SELECT "TraitObservation"."measurementName" AS trait, |
|
85 |
"TraitObservation"."measurementValue" AS value, |
|
86 |
"TraitObservation"."measurementUnit" AS units |
|
87 |
FROM "TraitObservation" |
|
88 |
WHERE (((("TraitObservation"."taxonName" IS NOT NULL) AND ("TraitObservation"."taxonName" <> ''::text)) AND ("TraitObservation"."measurementName" IS NOT NULL)) AND ("TraitObservation"."measurementName" <> ''::text)) |
|
89 |
ORDER BY "TraitObservation"."measurementName", "TraitObservation"."measurementValue", "TraitObservation"."measurementUnit"; |
|
90 |
|
|
91 |
|
|
92 |
-- |
|
93 |
-- Name: _traits_08_taxonname_trait_and_value; Type: VIEW; Schema: bien2_traits; Owner: - |
|
94 |
-- |
|
95 |
|
|
96 |
CREATE VIEW _traits_08_taxonname_trait_and_value AS |
|
97 |
SELECT btrim(concat_ws(' '::text, ifnull("TraitObservation"."taxonName", ''::text), ifnull("TraitObservation"."scientificNameAuthorship", ''::text))) AS taxonwithauthor, |
|
98 |
"TraitObservation"."measurementName" AS trait, |
|
99 |
"TraitObservation"."measurementValue" AS value |
|
100 |
FROM "TraitObservation" |
|
101 |
WHERE (((("TraitObservation"."taxonName" IS NOT NULL) AND ("TraitObservation"."taxonName" <> ''::text)) AND ("TraitObservation"."measurementName" IS NOT NULL)) AND ("TraitObservation"."measurementName" <> ''::text)) |
|
102 |
ORDER BY btrim(concat_ws(' '::text, ifnull("TraitObservation"."taxonName", ''::text), ifnull("TraitObservation"."scientificNameAuthorship", ''::text))), "TraitObservation"."measurementName", "TraitObservation"."measurementValue"; |
|
103 |
|
|
104 |
|
|
105 |
-- |
|
106 |
-- PostgreSQL database dump complete |
|
107 |
-- |
|
108 |
|
trunk/inputs/SALVIAS/validations.sql | ||
---|---|---|
1 |
-- |
|
2 |
-- PostgreSQL database dump |
|
3 |
-- |
|
4 |
|
|
5 |
SET statement_timeout = 0; |
|
6 |
SET lock_timeout = 0; |
|
7 |
SET client_encoding = 'UTF8'; |
|
8 |
SET standard_conforming_strings = on; |
|
9 |
SET check_function_bodies = false; |
|
10 |
SET client_min_messages = warning; |
|
11 |
|
|
12 |
SET search_path = "SALVIAS", pg_catalog; |
|
13 |
|
|
14 |
-- |
|
15 |
-- Name: _plots_01_count_of_projects; Type: VIEW; Schema: SALVIAS; Owner: - |
|
16 |
-- |
|
17 |
|
|
18 |
CREATE OR REPLACE VIEW _plots_01_count_of_projects AS |
|
19 |
SELECT count(*) AS projects |
|
20 |
FROM projects; |
|
21 |
|
|
22 |
|
|
23 |
-- |
|
24 |
-- Name: _plots_02_list_of_project_names; Type: VIEW; Schema: SALVIAS; Owner: - |
|
25 |
-- |
|
26 |
|
|
27 |
CREATE OR REPLACE VIEW _plots_02_list_of_project_names AS |
|
28 |
SELECT projects.project_name |
|
29 |
FROM projects; |
|
30 |
|
|
31 |
|
|
32 |
-- |
|
33 |
-- Name: _plots_03_count_of_all_plots_in_this_source; Type: VIEW; Schema: SALVIAS; Owner: - |
|
34 |
-- |
|
35 |
|
|
36 |
CREATE OR REPLACE VIEW _plots_03_count_of_all_plots_in_this_source AS |
|
37 |
SELECT count(DISTINCT (pm."SiteCode")::text) AS plots |
|
38 |
FROM (projects p |
|
39 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))); |
|
40 |
|
|
41 |
|
|
42 |
-- |
|
43 |
-- Name: _plots_04_count_of_plots_in_each_project_in_this_source; Type: VIEW; Schema: SALVIAS; Owner: - |
|
44 |
-- |
|
45 |
|
|
46 |
CREATE OR REPLACE VIEW _plots_04_count_of_plots_in_each_project_in_this_source AS |
|
47 |
SELECT p.project_name, |
|
48 |
count(*) AS plots |
|
49 |
FROM (projects p |
|
50 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
51 |
GROUP BY p.project_name; |
|
52 |
|
|
53 |
|
|
54 |
-- |
|
55 |
-- Name: _plots_05_list_of_plot_codes_by_project; Type: VIEW; Schema: SALVIAS; Owner: - |
|
56 |
-- |
|
57 |
|
|
58 |
CREATE OR REPLACE VIEW _plots_05_list_of_plot_codes_by_project AS |
|
59 |
SELECT p.project_name, |
|
60 |
(pm."SiteCode")::text AS plot_code |
|
61 |
FROM (projects p |
|
62 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))); |
|
63 |
|
|
64 |
|
|
65 |
-- |
|
66 |
-- Name: _plots_06_list_of_plots_with_stem_measurements; Type: VIEW; Schema: SALVIAS; Owner: - |
|
67 |
-- |
|
68 |
|
|
69 |
CREATE OR REPLACE VIEW _plots_06_list_of_plots_with_stem_measurements AS |
|
70 |
SELECT DISTINCT p.project_name, |
|
71 |
(pm."SiteCode")::text AS plot_code |
|
72 |
FROM (((projects p |
|
73 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
74 |
JOIN "plotObservations" po ON ((pm."PlotID" = po."PlotID"))) |
|
75 |
JOIN stems s ON ((po."PlotObsID" = s.plotobs_id))) |
|
76 |
GROUP BY p.project_name, (pm."SiteCode")::text |
|
77 |
ORDER BY p.project_name, (pm."SiteCode")::text; |
|
78 |
|
|
79 |
|
|
80 |
-- |
|
81 |
-- Name: _plots_06a_list_of_stems; Type: VIEW; Schema: SALVIAS; Owner: - |
|
82 |
-- |
|
83 |
|
|
84 |
CREATE OR REPLACE VIEW _plots_06a_list_of_stems AS |
|
85 |
SELECT p.project_name, |
|
86 |
(pm."SiteCode")::text AS plot_code, |
|
87 |
(s.stem_id)::text AS stem_id |
|
88 |
FROM (((projects p |
|
89 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
90 |
JOIN "plotObservations" po ON ((pm."PlotID" = po."PlotID"))) |
|
91 |
JOIN stems s ON ((po."PlotObsID" = s.plotobs_id))) |
|
92 |
ORDER BY p.project_name, (pm."SiteCode")::text, (s.stem_id)::text; |
|
93 |
|
|
94 |
|
|
95 |
-- |
|
96 |
-- Name: _plots_07_list_of_plots_which_use_counts_of_indiv_per_species; Type: VIEW; Schema: SALVIAS; Owner: - |
|
97 |
-- |
|
98 |
|
|
99 |
CREATE OR REPLACE VIEW _plots_07_list_of_plots_which_use_counts_of_indiv_per_species AS |
|
100 |
SELECT DISTINCT p.project_name, |
|
101 |
(pm."SiteCode")::text AS plot_code |
|
102 |
FROM ((projects p |
|
103 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
104 |
JOIN "plotObservations" po ON (((pm."PlotID" = po."PlotID") AND (po."NoInd" > 1)))) |
|
105 |
GROUP BY p.project_name, (pm."SiteCode")::text |
|
106 |
ORDER BY p.project_name, (pm."SiteCode")::text; |
|
107 |
|
|
108 |
|
|
109 |
-- |
|
110 |
-- Name: _plots_08_list_of_plots_which_use_percent_cover; Type: VIEW; Schema: SALVIAS; Owner: - |
|
111 |
-- |
|
112 |
|
|
113 |
CREATE OR REPLACE VIEW _plots_08_list_of_plots_which_use_percent_cover AS |
|
114 |
SELECT DISTINCT p.project_name, |
|
115 |
(pm."SiteCode")::text AS plot_code |
|
116 |
FROM ((projects p |
|
117 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
118 |
JOIN "plotObservations" po ON (((pm."PlotID" = po."PlotID") AND (po.cover_percent IS NOT NULL)))) |
|
119 |
GROUP BY p.project_name, (pm."SiteCode")::text |
|
120 |
ORDER BY p.project_name, (pm."SiteCode")::text; |
|
121 |
|
|
122 |
|
|
123 |
-- |
|
124 |
-- Name: _plots_09_list_of_plots_which_use_line_intercept; Type: VIEW; Schema: SALVIAS; Owner: - |
|
125 |
-- |
|
126 |
|
|
127 |
CREATE OR REPLACE VIEW _plots_09_list_of_plots_which_use_line_intercept AS |
|
128 |
SELECT DISTINCT p.project_name, |
|
129 |
(pm."SiteCode")::text AS plot_code |
|
130 |
FROM ((projects p |
|
131 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
132 |
JOIN "plotObservations" po ON (((pm."PlotID" = po."PlotID") AND (po.intercept_cm IS NOT NULL)))) |
|
133 |
GROUP BY p.project_name, (pm."SiteCode")::text |
|
134 |
ORDER BY p.project_name, (pm."SiteCode")::text; |
|
135 |
|
|
136 |
|
|
137 |
-- |
|
138 |
-- Name: _plots_10_count_of_individuals_per_plot_in_each_project; Type: VIEW; Schema: SALVIAS; Owner: - |
|
139 |
-- |
|
140 |
|
|
141 |
CREATE OR REPLACE VIEW _plots_10_count_of_individuals_per_plot_in_each_project AS |
|
142 |
SELECT p.project_name, |
|
143 |
(pm."SiteCode")::text AS plot_code, |
|
144 |
sum(po."NoInd") AS individuals |
|
145 |
FROM ((projects p |
|
146 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
147 |
JOIN "plotObservations" po ON ((pm."PlotID" = po."PlotID"))) |
|
148 |
GROUP BY p.project_name, (pm."SiteCode")::text |
|
149 |
ORDER BY p.project_name, (pm."SiteCode")::text; |
|
150 |
|
|
151 |
|
|
152 |
-- |
|
153 |
-- Name: VIEW _plots_10_count_of_individuals_per_plot_in_each_project; Type: COMMENT; Schema: SALVIAS; Owner: - |
|
154 |
-- |
|
155 |
|
|
156 |
COMMENT ON VIEW _plots_10_count_of_individuals_per_plot_in_each_project IS ' |
|
157 |
Method: Sum on NoInd (number of individuals) column. |
|
158 |
Note 1: `individuals` should be NULL for plots which use percent cover or line-intercept methods. |
|
159 |
Note 2: Do not count records in plotObservations table, as this will give incorrect total for plots such as Gentry plot, which count individuals per species per subplot |
|
160 |
'; |
|
161 |
|
|
162 |
|
|
163 |
-- |
|
164 |
-- Name: _plots_10a_aggregate_observation_individual_counts; Type: VIEW; Schema: SALVIAS; Owner: - |
|
165 |
-- |
|
166 |
|
|
167 |
CREATE OR REPLACE VIEW _plots_10a_aggregate_observation_individual_counts AS |
|
168 |
SELECT p.project_name, |
|
169 |
(pm."SiteCode")::text AS plot_code, |
|
170 |
(po."PlotObsID")::text AS individual_id, |
|
171 |
po."NoInd" AS individuals |
|
172 |
FROM ((projects p |
|
173 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
174 |
JOIN "plotObservations" po ON ((pm."PlotID" = po."PlotID"))) |
|
175 |
ORDER BY p.project_name, (pm."SiteCode")::text, (po."PlotObsID")::text; |
|
176 |
|
|
177 |
|
|
178 |
-- |
|
179 |
-- Name: VIEW _plots_10a_aggregate_observation_individual_counts; Type: COMMENT; Schema: SALVIAS; Owner: - |
|
180 |
-- |
|
181 |
|
|
182 |
COMMENT ON VIEW _plots_10a_aggregate_observation_individual_counts IS ' |
|
183 |
Note 1: `individuals` should be NULL for plots which use percent cover or line-intercept methods. |
|
184 |
'; |
|
185 |
|
|
186 |
|
|
187 |
-- |
|
188 |
-- Name: _plots_11_count_of_stems_per_plot_in_each_project; Type: VIEW; Schema: SALVIAS; Owner: - |
|
189 |
-- |
|
190 |
|
|
191 |
CREATE OR REPLACE VIEW _plots_11_count_of_stems_per_plot_in_each_project AS |
|
192 |
SELECT p.project_name, |
|
193 |
(pm."SiteCode")::text AS plot_code, |
|
194 |
count(DISTINCT s.stem_id) AS stems |
|
195 |
FROM (((projects p |
|
196 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
197 |
JOIN "plotObservations" po ON ((pm."PlotID" = po."PlotID"))) |
|
198 |
JOIN stems s ON ((po."PlotObsID" = s.plotobs_id))) |
|
199 |
GROUP BY p.project_name, (pm."SiteCode")::text |
|
200 |
ORDER BY p.project_name, (pm."SiteCode")::text; |
|
201 |
|
|
202 |
|
|
203 |
-- |
|
204 |
-- Name: VIEW _plots_11_count_of_stems_per_plot_in_each_project; Type: COMMENT; Schema: SALVIAS; Owner: - |
|
205 |
-- |
|
206 |
|
|
207 |
COMMENT ON VIEW _plots_11_count_of_stems_per_plot_in_each_project IS ' |
|
208 |
Method: count records in stems table |
|
209 |
'; |
|
210 |
|
|
211 |
|
|
212 |
-- |
|
213 |
-- Name: _plots_12_count_of_verbatim_taxa_per_plot_in_each_project; Type: VIEW; Schema: SALVIAS; Owner: - |
|
214 |
-- |
|
215 |
|
|
216 |
CREATE OR REPLACE VIEW _plots_12_count_of_verbatim_taxa_per_plot_in_each_project AS |
|
217 |
SELECT a.project_name, |
|
218 |
a.plot_code, |
|
219 |
count(a.taxon) AS taxa |
|
220 |
FROM ( SELECT DISTINCT p.project_name, |
|
221 |
(pm."SiteCode")::text AS plot_code, |
|
222 |
btrim(concat_ws(' '::text, ifnull((po."Family")::text, ''::text), ifnull((po."Genus")::text, ''::text), ifnull((po."Species")::text, ''::text), if((po.infra_ep_1 IS NULL), ifnull((po.auth)::text, ''::text), btrim(concat_ws(' '::text, ifnull((po.infra_rank_1)::text, ''::text), ifnull((po.infra_ep_1)::text, ''::text), ifnull((po.infra_auth_1)::text, ''::text)))))) AS taxon |
|
223 |
FROM ((projects p |
|
224 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
225 |
JOIN "plotObservations" po ON ((pm."PlotID" = po."PlotID")))) a |
|
226 |
GROUP BY a.project_name, a.plot_code |
|
227 |
ORDER BY a.project_name, a.plot_code; |
|
228 |
|
|
229 |
|
|
230 |
-- |
|
231 |
-- Name: VIEW _plots_12_count_of_verbatim_taxa_per_plot_in_each_project; Type: COMMENT; Schema: SALVIAS; Owner: - |
|
232 |
-- |
|
233 |
|
|
234 |
COMMENT ON VIEW _plots_12_count_of_verbatim_taxa_per_plot_in_each_project IS ' |
|
235 |
Note: Assumes identical concatenation of taxonomic fields to form verbatim taxon name in vegBIEN |
|
236 |
'; |
|
237 |
|
|
238 |
|
|
239 |
-- |
|
240 |
-- Name: _plots_13_list_of_distinct_verbatim_taxa_in_each_plot_in_each_p; Type: VIEW; Schema: SALVIAS; Owner: - |
|
241 |
-- |
|
242 |
|
|
243 |
CREATE OR REPLACE VIEW _plots_13_list_of_distinct_verbatim_taxa_in_each_plot_in_each_p AS |
|
244 |
SELECT DISTINCT p.project_name, |
|
245 |
(pm."SiteCode")::text AS plot_code, |
|
246 |
btrim(concat_ws(' '::text, ifnull((po."Family")::text, ''::text), ifnull((po."Genus")::text, ''::text), ifnull((po."Species")::text, ''::text), if((po.infra_ep_1 IS NULL), ifnull((po.auth)::text, ''::text), btrim(concat_ws(' '::text, ifnull((po.infra_rank_1)::text, ''::text), ifnull((po.infra_ep_1)::text, ''::text), ifnull((po.infra_auth_1)::text, ''::text)))))) AS taxon |
|
247 |
FROM ((projects p |
|
248 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
249 |
JOIN "plotObservations" po ON ((pm."PlotID" = po."PlotID"))) |
|
250 |
ORDER BY p.project_name, (pm."SiteCode")::text, btrim(concat_ws(' '::text, ifnull((po."Family")::text, ''::text), ifnull((po."Genus")::text, ''::text), ifnull((po."Species")::text, ''::text), if((po.infra_ep_1 IS NULL), ifnull((po.auth)::text, ''::text), btrim(concat_ws(' '::text, ifnull((po.infra_rank_1)::text, ''::text), ifnull((po.infra_ep_1)::text, ''::text), ifnull((po.infra_auth_1)::text, ''::text)))))); |
|
251 |
|
|
252 |
|
|
253 |
-- |
|
254 |
-- Name: VIEW _plots_13_list_of_distinct_verbatim_taxa_in_each_plot_in_each_p; Type: COMMENT; Schema: SALVIAS; Owner: - |
|
255 |
-- |
|
256 |
|
|
257 |
COMMENT ON VIEW _plots_13_list_of_distinct_verbatim_taxa_in_each_plot_in_each_p IS ' |
|
258 |
Note: Assumes identical concatenation of taxonomic fields to form verbatim taxon name in vegBIEN. |
|
259 |
'; |
|
260 |
|
|
261 |
|
|
262 |
-- |
|
263 |
-- Name: _plots_14_count_of_indiv_per_verbatim_taxon_per_plot_in_each_pr; Type: VIEW; Schema: SALVIAS; Owner: - |
|
264 |
-- |
|
265 |
|
|
266 |
CREATE OR REPLACE VIEW _plots_14_count_of_indiv_per_verbatim_taxon_per_plot_in_each_pr AS |
|
267 |
SELECT DISTINCT p.project_name, |
|
268 |
(pm."SiteCode")::text AS plot_code, |
|
269 |
btrim(concat_ws(' '::text, ifnull((po."Family")::text, ''::text), ifnull((po."Genus")::text, ''::text), ifnull((po."Species")::text, ''::text), if((po.infra_ep_1 IS NULL), ifnull((po.auth)::text, ''::text), btrim(concat_ws(' '::text, ifnull((po.infra_rank_1)::text, ''::text), ifnull((po.infra_ep_1)::text, ''::text), ifnull((po.infra_auth_1)::text, ''::text)))))) AS taxon, |
|
270 |
sum(po."NoInd") AS individuals |
|
271 |
FROM ((projects p |
|
272 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
273 |
JOIN "plotObservations" po ON ((pm."PlotID" = po."PlotID"))) |
|
274 |
GROUP BY p.project_name, (pm."SiteCode")::text, btrim(concat_ws(' '::text, ifnull((po."Family")::text, ''::text), ifnull((po."Genus")::text, ''::text), ifnull((po."Species")::text, ''::text), if((po.infra_ep_1 IS NULL), ifnull((po.auth)::text, ''::text), btrim(concat_ws(' '::text, ifnull((po.infra_rank_1)::text, ''::text), ifnull((po.infra_ep_1)::text, ''::text), ifnull((po.infra_auth_1)::text, ''::text)))))) |
|
275 |
ORDER BY p.project_name, (pm."SiteCode")::text, btrim(concat_ws(' '::text, ifnull((po."Family")::text, ''::text), ifnull((po."Genus")::text, ''::text), ifnull((po."Species")::text, ''::text), if((po.infra_ep_1 IS NULL), ifnull((po.auth)::text, ''::text), btrim(concat_ws(' '::text, ifnull((po.infra_rank_1)::text, ''::text), ifnull((po.infra_ep_1)::text, ''::text), ifnull((po.infra_auth_1)::text, ''::text)))))); |
|
276 |
|
|
277 |
|
|
278 |
-- |
|
279 |
-- Name: VIEW _plots_14_count_of_indiv_per_verbatim_taxon_per_plot_in_each_pr; Type: COMMENT; Schema: SALVIAS; Owner: - |
|
280 |
-- |
|
281 |
|
|
282 |
COMMENT ON VIEW _plots_14_count_of_indiv_per_verbatim_taxon_per_plot_in_each_pr IS ' |
|
283 |
Note: Assumes identical concatenation of taxonomic fields to form verbatim taxon name in vegBIEN |
|
284 |
'; |
|
285 |
|
|
286 |
|
|
287 |
-- |
|
288 |
-- Name: _plots_15_pct_cover_of_each_verb_taxon_in_each_plot_in_each_pro; Type: VIEW; Schema: SALVIAS; Owner: - |
|
289 |
-- |
|
290 |
|
|
291 |
CREATE OR REPLACE VIEW _plots_15_pct_cover_of_each_verb_taxon_in_each_plot_in_each_pro AS |
|
292 |
SELECT DISTINCT p.project_name, |
|
293 |
(pm."SiteCode")::text AS plot_code, |
|
294 |
btrim(concat_ws(' '::text, ifnull((po."Family")::text, ''::text), ifnull((po."Genus")::text, ''::text), ifnull((po."Species")::text, ''::text), if((po.infra_ep_1 IS NULL), ifnull((po.auth)::text, ''::text), btrim(concat_ws(' '::text, ifnull((po.infra_rank_1)::text, ''::text), ifnull((po.infra_ep_1)::text, ''::text), ifnull((po.infra_auth_1)::text, ''::text)))))) AS taxon, |
|
295 |
sum((po.cover_percent)::double precision) AS totalpercentcover |
|
296 |
FROM ((projects p |
|
297 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
298 |
JOIN "plotObservations" po ON (((pm."PlotID" = po."PlotID") AND (po.cover_percent IS NOT NULL)))) |
|
299 |
GROUP BY p.project_name, (pm."SiteCode")::text, btrim(concat_ws(' '::text, ifnull((po."Family")::text, ''::text), ifnull((po."Genus")::text, ''::text), ifnull((po."Species")::text, ''::text), if((po.infra_ep_1 IS NULL), ifnull((po.auth)::text, ''::text), btrim(concat_ws(' '::text, ifnull((po.infra_rank_1)::text, ''::text), ifnull((po.infra_ep_1)::text, ''::text), ifnull((po.infra_auth_1)::text, ''::text)))))) |
|
300 |
ORDER BY p.project_name, (pm."SiteCode")::text, btrim(concat_ws(' '::text, ifnull((po."Family")::text, ''::text), ifnull((po."Genus")::text, ''::text), ifnull((po."Species")::text, ''::text), if((po.infra_ep_1 IS NULL), ifnull((po.auth)::text, ''::text), btrim(concat_ws(' '::text, ifnull((po.infra_rank_1)::text, ''::text), ifnull((po.infra_ep_1)::text, ''::text), ifnull((po.infra_auth_1)::text, ''::text)))))); |
|
301 |
|
|
302 |
|
|
303 |
-- |
|
304 |
-- Name: VIEW _plots_15_pct_cover_of_each_verb_taxon_in_each_plot_in_each_pro; Type: COMMENT; Schema: SALVIAS; Owner: - |
|
305 |
-- |
|
306 |
|
|
307 |
COMMENT ON VIEW _plots_15_pct_cover_of_each_verb_taxon_in_each_plot_in_each_pro IS ' |
|
308 |
Note 1: Assumes identical concatenation of taxonomic fields to form verbatim taxon name in vegbien |
|
309 |
Note 2: Grouping mean cover for entire plot allows inclusion of plots with subplots (separate cover measure for each species in each subplot), plots with strata (separate cover measures for each species in each stratum), and plots without subplots or strata (one cover measure per species per plot) in same query. |
|
310 |
Note 3: currently, there are no SALVIAS percent cover plots in BIEN |
|
311 |
'; |
|
312 |
|
|
313 |
|
|
314 |
-- |
|
315 |
-- Name: _plots_16_intercepts_for_each_verb_taxon_in_each_plot_each_proj; Type: VIEW; Schema: SALVIAS; Owner: - |
|
316 |
-- |
|
317 |
|
|
318 |
CREATE OR REPLACE VIEW _plots_16_intercepts_for_each_verb_taxon_in_each_plot_each_proj AS |
|
319 |
SELECT DISTINCT p.project_name, |
|
320 |
(pm."SiteCode")::text AS plot_code, |
|
321 |
btrim(concat_ws(' '::text, ifnull((po."Family")::text, ''::text), ifnull((po."Genus")::text, ''::text), ifnull((po."Species")::text, ''::text), if((po.infra_ep_1 IS NULL), ifnull((po.auth)::text, ''::text), btrim(concat_ws(' '::text, ifnull((po.infra_rank_1)::text, ''::text), ifnull((po.infra_ep_1)::text, ''::text), ifnull((po.infra_auth_1)::text, ''::text)))))) AS taxon, |
|
322 |
po.intercept_cm |
|
323 |
FROM ((projects p |
|
324 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
325 |
JOIN "plotObservations" po ON (((pm."PlotID" = po."PlotID") AND (po.intercept_cm IS NOT NULL)))) |
|
326 |
ORDER BY p.project_name, (pm."SiteCode")::text, btrim(concat_ws(' '::text, ifnull((po."Family")::text, ''::text), ifnull((po."Genus")::text, ''::text), ifnull((po."Species")::text, ''::text), if((po.infra_ep_1 IS NULL), ifnull((po.auth)::text, ''::text), btrim(concat_ws(' '::text, ifnull((po.infra_rank_1)::text, ''::text), ifnull((po.infra_ep_1)::text, ''::text), ifnull((po.infra_auth_1)::text, ''::text)))))); |
|
327 |
|
|
328 |
|
|
329 |
-- |
|
330 |
-- Name: VIEW _plots_16_intercepts_for_each_verb_taxon_in_each_plot_each_proj; Type: COMMENT; Schema: SALVIAS; Owner: - |
|
331 |
-- |
|
332 |
|
|
333 |
COMMENT ON VIEW _plots_16_intercepts_for_each_verb_taxon_in_each_plot_each_proj IS ' |
|
334 |
Note 1: Assumes identical concatenation of taxonomic fields to form verbatim taxon name in vegbien |
|
335 |
Note 2: Grouping mean cover for entire plot combines plots with subplots (separate cover measure for each species in each subplot) with plots with strata (separate cover measures for each species in each stratum) with plots without subplots or strata (one cover measure per species per plot. |
|
336 |
'; |
|
337 |
|
|
338 |
|
|
339 |
-- |
|
340 |
-- Name: _plots_17_count_of_subplots_per_plot_for_each_project; Type: VIEW; Schema: SALVIAS; Owner: - |
|
341 |
-- |
|
342 |
|
|
343 |
CREATE OR REPLACE VIEW _plots_17_count_of_subplots_per_plot_for_each_project AS |
|
344 |
SELECT p.project_name, |
|
345 |
(pm."SiteCode")::text AS plot_code, |
|
346 |
count(DISTINCT po."Line") AS subplots |
|
347 |
FROM ((projects p |
|
348 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
349 |
JOIN "plotObservations" po ON ((pm."PlotID" = po."PlotID"))) |
|
350 |
GROUP BY p.project_name, (pm."SiteCode")::text |
|
351 |
ORDER BY p.project_name, (pm."SiteCode")::text; |
|
352 |
|
|
353 |
|
|
354 |
-- |
|
355 |
-- Name: _plots_18_list_of_subplots_codes_for_each_plot_for_each_project; Type: VIEW; Schema: SALVIAS; Owner: - |
|
356 |
-- |
|
357 |
|
|
358 |
CREATE OR REPLACE VIEW _plots_18_list_of_subplots_codes_for_each_plot_for_each_project AS |
|
359 |
SELECT DISTINCT p.project_name, |
|
360 |
(pm."SiteCode")::text AS plot_code, |
|
361 |
po."Line" AS subplot_code |
|
362 |
FROM ((projects p |
|
363 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
364 |
JOIN "plotObservations" po ON (((pm."PlotID" = po."PlotID") AND ((pm."SiteCode")::text IS NOT NULL)))) |
|
365 |
ORDER BY p.project_name, (pm."SiteCode")::text, po."Line"; |
|
366 |
|
|
367 |
|
|
368 |
-- |
|
369 |
-- Name: VIEW _plots_18_list_of_subplots_codes_for_each_plot_for_each_project; Type: COMMENT; Schema: SALVIAS; Owner: - |
|
370 |
-- |
|
371 |
|
|
372 |
COMMENT ON VIEW _plots_18_list_of_subplots_codes_for_each_plot_for_each_project IS ' |
|
373 |
Note: includes plots with and without subplots |
|
374 |
'; |
|
375 |
|
|
376 |
|
|
377 |
-- |
|
378 |
-- Name: _plots_19_count_of_censuses_per_plot_in_each_project; Type: VIEW; Schema: SALVIAS; Owner: - |
|
379 |
-- |
|
380 |
|
|
381 |
CREATE OR REPLACE VIEW _plots_19_count_of_censuses_per_plot_in_each_project AS |
|
382 |
SELECT p.project_name, |
|
383 |
(pm."SiteCode")::text AS plot_code, |
|
384 |
count(DISTINCT ARRAY[po.census_date]) AS inventories |
|
385 |
FROM ((projects p |
|
386 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
387 |
LEFT JOIN "plotObservations" po ON (((pm."PlotID" = po."PlotID") AND ((pm."SiteCode")::text IS NOT NULL)))) |
|
388 |
GROUP BY p.project_name, (pm."SiteCode")::text |
|
389 |
ORDER BY p.project_name, (pm."SiteCode")::text; |
|
390 |
|
|
391 |
|
|
392 |
-- |
|
393 |
-- PostgreSQL database dump complete |
|
394 |
-- |
|
395 |
|
trunk/inputs/SALVIAS/validations.sql.run | ||
---|---|---|
1 |
#!/bin/bash -e |
|
2 |
. "$(dirname "${BASH_SOURCE[0]}")"/../../lib/runscripts/validations.pg.sql.run |
|
3 | 0 |
trunk/inputs/NY/validations.sql | ||
---|---|---|
1 |
-- |
|
2 |
-- PostgreSQL database dump |
|
3 |
-- |
|
4 |
|
|
5 |
SET statement_timeout = 0; |
|
6 |
SET lock_timeout = 0; |
|
7 |
SET client_encoding = 'UTF8'; |
|
8 |
SET standard_conforming_strings = on; |
|
9 |
SET check_function_bodies = false; |
|
10 |
SET client_min_messages = warning; |
|
11 |
|
|
12 |
SET search_path = "NY", pg_catalog; |
|
13 |
|
|
14 |
-- |
|
15 |
-- Name: _specimens_01_count_of_total_records_specimens_in_source_db; Type: VIEW; Schema: NY; Owner: - |
|
16 |
-- |
|
17 |
|
|
18 |
CREATE VIEW _specimens_01_count_of_total_records_specimens_in_source_db AS |
|
19 |
SELECT count(*) AS "totalSpecimenRecords" |
|
20 |
FROM "Ecatalog_all"; |
|
21 |
|
|
22 |
|
|
23 |
-- |
|
24 |
-- Name: VIEW _specimens_01_count_of_total_records_specimens_in_source_db; Type: COMMENT; Schema: NY; Owner: - |
|
25 |
-- |
|
26 |
|
|
27 |
COMMENT ON VIEW _specimens_01_count_of_total_records_specimens_in_source_db IS ' |
|
28 |
Check: should return 1 row |
|
29 |
'; |
|
30 |
|
|
31 |
|
|
32 |
-- |
|
33 |
-- Name: _specimens_02_count_of_unique_verbatim_families; Type: VIEW; Schema: NY; Owner: - |
|
34 |
-- |
|
35 |
|
|
36 |
CREATE VIEW _specimens_02_count_of_unique_verbatim_families AS |
|
37 |
SELECT count(DISTINCT "Ecatalog_all".family) AS families |
|
38 |
FROM "Ecatalog_all" |
|
39 |
WHERE ("Ecatalog_all".family IS NOT NULL); |
|
40 |
|
|
41 |
|
|
42 |
-- |
|
43 |
-- Name: VIEW _specimens_02_count_of_unique_verbatim_families; Type: COMMENT; Schema: NY; Owner: - |
|
44 |
-- |
|
45 |
|
|
46 |
COMMENT ON VIEW _specimens_02_count_of_unique_verbatim_families IS ' |
|
47 |
Check: should return 1 row |
|
48 |
'; |
|
49 |
|
|
50 |
|
|
51 |
-- |
|
52 |
-- Name: _specimens_03_list_of_verbatim_families; Type: VIEW; Schema: NY; Owner: - |
|
53 |
-- |
|
54 |
|
|
55 |
CREATE VIEW _specimens_03_list_of_verbatim_families AS |
|
56 |
SELECT DISTINCT "Ecatalog_all".family |
|
57 |
FROM "Ecatalog_all" |
|
58 |
WHERE (("Ecatalog_all".genus IS NOT NULL) AND ("Ecatalog_all"."specificEpithet" IS NOT NULL)); |
|
59 |
|
|
60 |
|
|
61 |
-- |
|
62 |
-- Name: VIEW _specimens_03_list_of_verbatim_families; Type: COMMENT; Schema: NY; Owner: - |
|
63 |
-- |
|
64 |
|
|
65 |
COMMENT ON VIEW _specimens_03_list_of_verbatim_families IS ' |
|
66 |
Check: should return same number of rows |
|
67 |
'; |
|
68 |
|
|
69 |
|
|
70 |
-- |
|
71 |
-- Name: _specimens_04_count_of_species_binomials; Type: VIEW; Schema: NY; Owner: - |
|
72 |
-- |
|
73 |
|
|
74 |
CREATE VIEW _specimens_04_count_of_species_binomials AS |
|
75 |
SELECT count(DISTINCT concat_ws(' '::text, "Ecatalog_all".genus, "Ecatalog_all"."specificEpithet")) AS species_binomials |
|
76 |
FROM "Ecatalog_all" |
|
77 |
WHERE (("Ecatalog_all".genus IS NOT NULL) AND ("Ecatalog_all"."specificEpithet" IS NOT NULL)); |
|
78 |
|
|
79 |
|
|
80 |
-- |
|
81 |
-- Name: VIEW _specimens_04_count_of_species_binomials; Type: COMMENT; Schema: NY; Owner: - |
|
82 |
-- |
|
83 |
|
|
84 |
COMMENT ON VIEW _specimens_04_count_of_species_binomials IS ' |
|
85 |
Check: should return 1 row |
|
86 |
'; |
|
87 |
|
|
88 |
|
|
89 |
-- |
|
90 |
-- Name: _specimens_05_list_of_species_binomials; Type: VIEW; Schema: NY; Owner: - |
|
91 |
-- |
|
92 |
|
|
93 |
CREATE VIEW _specimens_05_list_of_species_binomials AS |
|
94 |
SELECT DISTINCT concat_ws(' '::text, "Ecatalog_all".genus, "Ecatalog_all"."specificEpithet") AS species_binomial |
|
95 |
FROM "Ecatalog_all" |
|
96 |
WHERE (("Ecatalog_all".genus IS NOT NULL) AND ("Ecatalog_all"."specificEpithet" IS NOT NULL)); |
|
97 |
|
|
98 |
|
|
99 |
-- |
|
100 |
-- Name: VIEW _specimens_05_list_of_species_binomials; Type: COMMENT; Schema: NY; Owner: - |
|
101 |
-- |
|
102 |
|
|
103 |
COMMENT ON VIEW _specimens_05_list_of_species_binomials IS ' |
|
104 |
Check: should return 3335 rows |
|
105 |
'; |
|
106 |
|
|
107 |
|
|
108 |
-- |
|
109 |
-- Name: _specimens_06_count_of_unique_verb_subsp_taxa_with_author; Type: VIEW; Schema: NY; Owner: - |
|
110 |
-- |
|
111 |
|
|
112 |
CREATE VIEW _specimens_06_count_of_unique_verb_subsp_taxa_with_author AS |
|
113 |
SELECT count(DISTINCT "Ecatalog_all"."scientificName") AS taxon_names_with_author |
|
114 |
FROM "Ecatalog_all" |
|
115 |
WHERE ((("Ecatalog_all".genus IS NOT NULL) AND ("Ecatalog_all"."specificEpithet" IS NOT NULL)) AND ("Ecatalog_all".subspecies IS NOT NULL)); |
|
116 |
|
|
117 |
|
|
118 |
-- |
|
119 |
-- Name: VIEW _specimens_06_count_of_unique_verb_subsp_taxa_with_author; Type: COMMENT; Schema: NY; Owner: - |
|
120 |
-- |
|
121 |
|
|
122 |
COMMENT ON VIEW _specimens_06_count_of_unique_verb_subsp_taxa_with_author IS ' |
|
123 |
Check: should return 1 row |
|
124 |
'; |
|
125 |
|
|
126 |
|
|
127 |
-- |
|
128 |
-- Name: _specimens_07_list_of_verbatim_subspecific_taxa_with_author; Type: VIEW; Schema: NY; Owner: - |
|
129 |
-- |
|
130 |
|
|
131 |
CREATE VIEW _specimens_07_list_of_verbatim_subspecific_taxa_with_author AS |
|
132 |
SELECT DISTINCT "Ecatalog_all"."scientificName" AS taxon_name_with_author |
|
133 |
FROM "Ecatalog_all" |
|
134 |
WHERE ("Ecatalog_all".subspecies IS NOT NULL); |
|
135 |
|
|
136 |
|
|
137 |
-- |
|
138 |
-- Name: VIEW _specimens_07_list_of_verbatim_subspecific_taxa_with_author; Type: COMMENT; Schema: NY; Owner: - |
|
139 |
-- |
|
140 |
|
|
141 |
COMMENT ON VIEW _specimens_07_list_of_verbatim_subspecific_taxa_with_author IS ' |
|
142 |
Check: should return 40145 rows |
|
143 |
'; |
|
144 |
|
|
145 |
|
|
146 |
-- |
|
147 |
-- Name: _specimens_08_count_of_unique_verbatim_author_taxa_with_genus; Type: VIEW; Schema: NY; Owner: - |
|
148 |
-- |
|
149 |
|
|
150 |
CREATE VIEW _specimens_08_count_of_unique_verbatim_author_taxa_with_genus AS |
|
151 |
SELECT count(DISTINCT "Ecatalog_all"."scientificName") AS taxon_names_with_author |
|
152 |
FROM "Ecatalog_all" |
|
153 |
WHERE ("Ecatalog_all".genus IS NOT NULL); |
|
154 |
|
|
155 |
|
|
156 |
-- |
|
157 |
-- Name: VIEW _specimens_08_count_of_unique_verbatim_author_taxa_with_genus; Type: COMMENT; Schema: NY; Owner: - |
|
158 |
-- |
|
159 |
|
|
160 |
COMMENT ON VIEW _specimens_08_count_of_unique_verbatim_author_taxa_with_genus IS ' |
|
161 |
Check: should return 1 row |
|
162 |
'; |
|
163 |
|
|
164 |
|
|
165 |
-- |
|
166 |
-- Name: _specimens_09_list_of_unique_verbatim_author_taxa_with_genus; Type: VIEW; Schema: NY; Owner: - |
|
167 |
-- |
|
168 |
|
|
169 |
CREATE VIEW _specimens_09_list_of_unique_verbatim_author_taxa_with_genus AS |
|
170 |
SELECT DISTINCT "Ecatalog_all"."scientificName" AS taxon_name_with_author |
|
171 |
FROM "Ecatalog_all" |
|
172 |
WHERE ("Ecatalog_all".genus IS NOT NULL); |
|
173 |
|
|
174 |
|
|
175 |
-- |
|
176 |
-- Name: VIEW _specimens_09_list_of_unique_verbatim_author_taxa_with_genus; Type: COMMENT; Schema: NY; Owner: - |
|
177 |
-- |
|
178 |
|
|
179 |
COMMENT ON VIEW _specimens_09_list_of_unique_verbatim_author_taxa_with_genus IS ' |
|
180 |
Check: should return 45997 rows |
|
181 |
'; |
|
182 |
|
|
183 |
|
|
184 |
-- |
|
185 |
-- Name: _specimens_10_count_number_of_records_by_institution; Type: VIEW; Schema: NY; Owner: - |
|
186 |
-- |
|
187 |
|
|
188 |
CREATE VIEW _specimens_10_count_number_of_records_by_institution AS |
|
189 |
SELECT "Ecatalog_all".specimen_duplicate_institutions, |
|
190 |
count(*) AS records |
|
191 |
FROM "Ecatalog_all" |
|
192 |
GROUP BY "Ecatalog_all".specimen_duplicate_institutions; |
|
193 |
|
|
194 |
|
|
195 |
-- |
|
196 |
-- Name: VIEW _specimens_10_count_number_of_records_by_institution; Type: COMMENT; Schema: NY; Owner: - |
|
197 |
-- |
|
198 |
|
|
199 |
COMMENT ON VIEW _specimens_10_count_number_of_records_by_institution IS ' |
|
200 |
Note: Majority should be from ''NY''; these are standard herbarium acronyms |
|
201 |
|
|
202 |
Check: should return 6 rows |
|
203 |
'; |
|
204 |
|
|
205 |
|
|
206 |
-- |
|
207 |
-- Name: _specimens_11_list_of_three_standard_political_divisions; Type: VIEW; Schema: NY; Owner: - |
|
208 |
-- |
|
209 |
|
|
210 |
CREATE VIEW _specimens_11_list_of_three_standard_political_divisions AS |
|
211 |
SELECT DISTINCT "Ecatalog_all".country, |
|
212 |
"Ecatalog_all"."stateProvince", |
|
213 |
"Ecatalog_all".county |
|
214 |
FROM "Ecatalog_all"; |
|
215 |
|
|
216 |
|
|
217 |
-- |
|
218 |
-- Name: VIEW _specimens_11_list_of_three_standard_political_divisions; Type: COMMENT; Schema: NY; Owner: - |
|
219 |
-- |
|
220 |
|
|
221 |
COMMENT ON VIEW _specimens_11_list_of_three_standard_political_divisions IS ' |
|
222 |
Note: character set issues may cause mis-matches. This query is a good way to reveal character set issues, either in source db or in BIEN |
|
223 |
|
|
224 |
Check: should return 5232 rows |
|
225 |
'; |
|
226 |
|
|
227 |
|
|
228 |
-- |
|
229 |
-- Name: _specimens_12_distinct_collector_name_collect_num_date_w_count; Type: VIEW; Schema: NY; Owner: - |
|
230 |
-- |
|
231 |
|
|
232 |
CREATE VIEW _specimens_12_distinct_collector_name_collect_num_date_w_count AS |
|
233 |
SELECT ifnull("Ecatalog_all"."recordedBy", ''::text) AS "collectorName", |
|
234 |
ifnull("Ecatalog_all"."collectorNumber", ''::text) AS "collectionNumber", |
|
235 |
concat_ws('-'::text, "Ecatalog_all"."yearCollected", "Ecatalog_all"."monthCollected", "Ecatalog_all"."dayCollected") AS "dateCollected", |
|
236 |
count(*) AS "specimenRecords" |
|
237 |
FROM "Ecatalog_all" |
|
238 |
GROUP BY "Ecatalog_all"."recordedBy", "Ecatalog_all"."collectorNumber", concat_ws('-'::text, "Ecatalog_all"."yearCollected", "Ecatalog_all"."monthCollected", "Ecatalog_all"."dayCollected") |
|
239 |
ORDER BY "Ecatalog_all"."recordedBy", "Ecatalog_all"."collectorNumber", concat_ws('-'::text, "Ecatalog_all"."yearCollected", "Ecatalog_all"."monthCollected", "Ecatalog_all"."dayCollected"); |
|
240 |
|
|
241 |
|
|
242 |
-- |
|
243 |
-- Name: VIEW _specimens_12_distinct_collector_name_collect_num_date_w_count; Type: COMMENT; Schema: NY; Owner: - |
|
244 |
-- |
|
245 |
|
|
246 |
COMMENT ON VIEW _specimens_12_distinct_collector_name_collect_num_date_w_count IS ' |
|
247 |
Check: should return 309396 rows |
|
248 |
'; |
|
249 |
|
|
250 |
|
|
251 |
-- |
|
252 |
-- Name: _specimens_13_count_of_all_verbatim_and_decimal_lat_long; Type: VIEW; Schema: NY; Owner: - |
|
253 |
-- |
|
254 |
|
|
255 |
CREATE VIEW _specimens_13_count_of_all_verbatim_and_decimal_lat_long AS |
|
256 |
SELECT ( SELECT count(DISTINCT ROW("Ecatalog_all"."decimalLatitude", "Ecatalog_all"."decimalLongitude")) AS count |
|
257 |
FROM "Ecatalog_all" |
|
258 |
WHERE (("Ecatalog_all"."decimalLatitude" IS NOT NULL) OR ("Ecatalog_all"."decimalLongitude" IS NOT NULL))) AS "allLatLongs", |
|
259 |
( SELECT count(DISTINCT ROW("Ecatalog_all"."decimalLatitude", "Ecatalog_all"."decimalLongitude")) AS count |
|
260 |
FROM "Ecatalog_all" |
|
261 |
WHERE (is_castable("Ecatalog_all"."decimalLatitude", NULL::double precision) AND is_castable("Ecatalog_all"."decimalLongitude", NULL::double precision))) AS "decimalLatLongs"; |
|
262 |
|
|
263 |
|
|
264 |
-- |
|
265 |
-- Name: VIEW _specimens_13_count_of_all_verbatim_and_decimal_lat_long; Type: COMMENT; Schema: NY; Owner: - |
|
266 |
-- |
|
267 |
|
|
268 |
COMMENT ON VIEW _specimens_13_count_of_all_verbatim_and_decimal_lat_long IS ' |
|
269 |
Check: should return 1 row |
|
270 |
'; |
|
271 |
|
|
272 |
|
|
273 |
-- |
|
274 |
-- Name: _specimens_13a_list_of_all_verbatim_lat_long; Type: VIEW; Schema: NY; Owner: - |
|
275 |
-- |
|
276 |
|
|
277 |
CREATE VIEW _specimens_13a_list_of_all_verbatim_lat_long AS |
|
278 |
SELECT DISTINCT "Ecatalog_all"."decimalLatitude" AS "verbatimLatitude", |
|
279 |
"Ecatalog_all"."decimalLongitude" AS "verbatimLongitude" |
|
280 |
FROM "Ecatalog_all" |
|
281 |
WHERE (("Ecatalog_all"."decimalLatitude" IS NOT NULL) OR ("Ecatalog_all"."decimalLongitude" IS NOT NULL)); |
|
282 |
|
|
283 |
|
|
284 |
-- |
|
285 |
-- Name: _specimens_13b_list_of_all_decimal_lat_long; Type: VIEW; Schema: NY; Owner: - |
|
286 |
-- |
|
287 |
|
|
288 |
CREATE VIEW _specimens_13b_list_of_all_decimal_lat_long AS |
|
289 |
SELECT DISTINCT ("Ecatalog_all"."decimalLatitude")::double precision AS "decimalLatitude", |
|
290 |
("Ecatalog_all"."decimalLongitude")::double precision AS "decimalLongitude" |
|
291 |
FROM "Ecatalog_all" |
|
292 |
WHERE (is_castable("Ecatalog_all"."decimalLatitude", NULL::double precision) AND is_castable("Ecatalog_all"."decimalLongitude", NULL::double precision)); |
|
293 |
|
|
294 |
|
|
295 |
-- |
|
296 |
-- Name: _specimens_14_count_of_all_invalid_verbatim_lat_long; Type: VIEW; Schema: NY; Owner: - |
|
297 |
-- |
|
298 |
|
|
299 |
CREATE VIEW _specimens_14_count_of_all_invalid_verbatim_lat_long AS |
|
300 |
SELECT ( SELECT count(*) AS count |
|
301 |
FROM "Ecatalog_all" |
|
302 |
WHERE ((("Ecatalog_all"."decimalLatitude")::double precision > (90)::double precision) OR (("Ecatalog_all"."decimalLatitude")::double precision < ((-90))::double precision))) AS "badLats", |
|
303 |
( SELECT count(*) AS count |
|
304 |
FROM "Ecatalog_all" |
|
305 |
WHERE ((("Ecatalog_all"."decimalLongitude")::double precision > (180)::double precision) OR (("Ecatalog_all"."decimalLongitude")::double precision < ((-180))::double precision))) AS "badLongs"; |
|
306 |
|
|
307 |
|
|
308 |
-- |
|
309 |
-- Name: VIEW _specimens_14_count_of_all_invalid_verbatim_lat_long; Type: COMMENT; Schema: NY; Owner: - |
|
310 |
-- |
|
311 |
|
|
312 |
COMMENT ON VIEW _specimens_14_count_of_all_invalid_verbatim_lat_long IS ' |
|
313 |
Check: should return 1 row |
|
314 |
'; |
|
315 |
|
|
316 |
|
|
317 |
-- |
|
318 |
-- Name: _specimens_15_list_distinct_locality_descriptions; Type: VIEW; Schema: NY; Owner: - |
|
319 |
-- |
|
320 |
|
|
321 |
CREATE VIEW _specimens_15_list_distinct_locality_descriptions AS |
|
322 |
SELECT DISTINCT "Ecatalog_all".locality AS "localityDescription" |
|
323 |
FROM "Ecatalog_all" |
|
324 |
WHERE ("Ecatalog_all".locality IS NOT NULL); |
|
325 |
|
|
326 |
|
|
327 |
-- |
|
328 |
-- Name: VIEW _specimens_15_list_distinct_locality_descriptions; Type: COMMENT; Schema: NY; Owner: - |
|
329 |
-- |
|
330 |
|
|
331 |
COMMENT ON VIEW _specimens_15_list_distinct_locality_descriptions IS ' |
|
332 |
Check: should return 125592 records |
|
333 |
'; |
|
334 |
|
|
335 |
|
|
336 |
-- |
|
337 |
-- Name: _specimens_16_list_distinct_specimen_descriptions; Type: VIEW; Schema: NY; Owner: - |
|
338 |
-- |
|
339 |
|
|
340 |
CREATE VIEW _specimens_16_list_distinct_specimen_descriptions AS |
|
341 |
SELECT DISTINCT "Ecatalog_all"."specimenDescription" |
|
342 |
FROM "Ecatalog_all" |
|
343 |
WHERE ("Ecatalog_all"."specimenDescription" IS NOT NULL); |
|
344 |
|
|
345 |
|
|
346 |
-- |
|
347 |
-- Name: VIEW _specimens_16_list_distinct_specimen_descriptions; Type: COMMENT; Schema: NY; Owner: - |
|
348 |
-- |
|
349 |
|
|
350 |
COMMENT ON VIEW _specimens_16_list_distinct_specimen_descriptions IS ' |
|
351 |
Note: specimens descriptions in nybg extract is in column "specimenDescription" |
|
352 |
|
|
353 |
Check: should return 158460 records |
|
354 |
'; |
|
355 |
|
|
356 |
|
|
357 |
-- |
|
358 |
-- PostgreSQL database dump complete |
|
359 |
-- |
|
360 |
|
trunk/inputs/NY/validations.sql.run | ||
---|---|---|
1 |
#!/bin/bash -e |
|
2 |
. "$(dirname "${BASH_SOURCE[0]}")"/../../lib/runscripts/validations.pg.sql.run |
|
3 | 0 |
trunk/inputs/bien2_traits/verify/validations.sql | ||
---|---|---|
1 |
-- |
|
2 |
-- PostgreSQL database dump |
|
3 |
-- |
|
4 |
|
|
5 |
SET statement_timeout = 0; |
|
6 |
SET lock_timeout = 0; |
|
7 |
SET client_encoding = 'UTF8'; |
|
8 |
SET standard_conforming_strings = on; |
|
9 |
SET check_function_bodies = false; |
|
10 |
SET client_min_messages = warning; |
|
11 |
|
|
12 |
SET search_path = bien2_traits, pg_catalog; |
|
13 |
|
|
14 |
-- |
|
15 |
-- Name: _traits_01_count_records; Type: VIEW; Schema: bien2_traits; Owner: - |
|
16 |
-- |
|
17 |
|
|
18 |
CREATE VIEW _traits_01_count_records AS |
|
19 |
SELECT count(*) AS "totalRecords" |
|
20 |
FROM "TraitObservation" |
|
21 |
WHERE (((("TraitObservation"."taxonName" IS NOT NULL) AND ("TraitObservation"."taxonName" <> ''::text)) AND ("TraitObservation"."measurementName" IS NOT NULL)) AND ("TraitObservation"."measurementName" <> ''::text)); |
|
22 |
|
|
23 |
|
|
24 |
-- |
|
25 |
-- Name: _traits_02_count_trait_names; Type: VIEW; Schema: bien2_traits; Owner: - |
|
26 |
-- |
|
27 |
|
|
28 |
CREATE VIEW _traits_02_count_trait_names AS |
|
29 |
SELECT count(DISTINCT "TraitObservation"."measurementName") AS traits |
|
30 |
FROM "TraitObservation" |
|
31 |
WHERE (((("TraitObservation"."taxonName" IS NOT NULL) AND ("TraitObservation"."taxonName" <> ''::text)) AND ("TraitObservation"."measurementName" IS NOT NULL)) AND ("TraitObservation"."measurementName" <> ''::text)); |
|
32 |
|
|
33 |
|
|
34 |
-- |
|
35 |
-- Name: _traits_03_list_trait_names; Type: VIEW; Schema: bien2_traits; Owner: - |
|
36 |
-- |
|
37 |
|
|
38 |
CREATE VIEW _traits_03_list_trait_names AS |
|
39 |
SELECT DISTINCT "TraitObservation"."measurementName" AS trait |
|
40 |
FROM "TraitObservation" |
|
41 |
WHERE (((("TraitObservation"."taxonName" IS NOT NULL) AND ("TraitObservation"."taxonName" <> ''::text)) AND ("TraitObservation"."measurementName" IS NOT NULL)) AND ("TraitObservation"."measurementName" <> ''::text)) |
|
42 |
ORDER BY "TraitObservation"."measurementName"; |
|
43 |
|
|
44 |
|
|
45 |
-- |
|
46 |
-- Name: _traits_04_count_records_per_trait; Type: VIEW; Schema: bien2_traits; Owner: - |
|
47 |
-- |
|
48 |
|
|
49 |
CREATE VIEW _traits_04_count_records_per_trait AS |
|
50 |
SELECT "TraitObservation"."measurementName" AS trait, |
|
51 |
count(*) AS measurements |
|
52 |
FROM "TraitObservation" |
|
53 |
WHERE (((("TraitObservation"."taxonName" IS NOT NULL) AND ("TraitObservation"."taxonName" <> ''::text)) AND ("TraitObservation"."measurementName" IS NOT NULL)) AND ("TraitObservation"."measurementName" <> ''::text)) |
|
54 |
GROUP BY "TraitObservation"."measurementName" |
|
55 |
ORDER BY "TraitObservation"."measurementName"; |
|
56 |
|
|
57 |
|
|
58 |
-- |
|
59 |
-- Name: _traits_05_count_taxa; Type: VIEW; Schema: bien2_traits; Owner: - |
|
60 |
-- |
|
61 |
|
|
62 |
CREATE VIEW _traits_05_count_taxa AS |
|
63 |
SELECT count(DISTINCT btrim(concat_ws(' '::text, ifnull("TraitObservation"."taxonName", ''::text), ifnull("TraitObservation"."scientificNameAuthorship", ''::text)))) AS taxa |
|
64 |
FROM "TraitObservation" |
|
65 |
WHERE (((("TraitObservation"."taxonName" IS NOT NULL) AND ("TraitObservation"."taxonName" <> ''::text)) AND ("TraitObservation"."measurementName" IS NOT NULL)) AND ("TraitObservation"."measurementName" <> ''::text)); |
|
66 |
|
|
67 |
|
|
68 |
-- |
|
69 |
-- Name: _traits_06_list_distinct_taxa; Type: VIEW; Schema: bien2_traits; Owner: - |
|
70 |
-- |
|
71 |
|
|
72 |
CREATE VIEW _traits_06_list_distinct_taxa AS |
|
73 |
SELECT DISTINCT btrim(concat_ws(' '::text, ifnull("TraitObservation"."taxonName", ''::text), ifnull("TraitObservation"."scientificNameAuthorship", ''::text))) AS taxonwithauthor |
|
74 |
FROM "TraitObservation" |
|
75 |
WHERE (((("TraitObservation"."taxonName" IS NOT NULL) AND ("TraitObservation"."taxonName" <> ''::text)) AND ("TraitObservation"."measurementName" IS NOT NULL)) AND ("TraitObservation"."measurementName" <> ''::text)) |
|
76 |
ORDER BY btrim(concat_ws(' '::text, ifnull("TraitObservation"."taxonName", ''::text), ifnull("TraitObservation"."scientificNameAuthorship", ''::text))); |
|
77 |
|
|
78 |
|
|
79 |
-- |
|
80 |
-- Name: _traits_07_trait_value_and_units; Type: VIEW; Schema: bien2_traits; Owner: - |
|
81 |
-- |
|
82 |
|
|
83 |
CREATE VIEW _traits_07_trait_value_and_units AS |
|
84 |
SELECT "TraitObservation"."measurementName" AS trait, |
|
85 |
"TraitObservation"."measurementValue" AS value, |
|
86 |
"TraitObservation"."measurementUnit" AS units |
|
87 |
FROM "TraitObservation" |
|
88 |
WHERE (((("TraitObservation"."taxonName" IS NOT NULL) AND ("TraitObservation"."taxonName" <> ''::text)) AND ("TraitObservation"."measurementName" IS NOT NULL)) AND ("TraitObservation"."measurementName" <> ''::text)) |
|
89 |
ORDER BY "TraitObservation"."measurementName", "TraitObservation"."measurementValue", "TraitObservation"."measurementUnit"; |
|
90 |
|
|
91 |
|
|
92 |
-- |
|
93 |
-- Name: _traits_08_taxonname_trait_and_value; Type: VIEW; Schema: bien2_traits; Owner: - |
|
94 |
-- |
|
95 |
|
|
96 |
CREATE VIEW _traits_08_taxonname_trait_and_value AS |
|
97 |
SELECT btrim(concat_ws(' '::text, ifnull("TraitObservation"."taxonName", ''::text), ifnull("TraitObservation"."scientificNameAuthorship", ''::text))) AS taxonwithauthor, |
|
98 |
"TraitObservation"."measurementName" AS trait, |
|
99 |
"TraitObservation"."measurementValue" AS value |
|
100 |
FROM "TraitObservation" |
|
101 |
WHERE (((("TraitObservation"."taxonName" IS NOT NULL) AND ("TraitObservation"."taxonName" <> ''::text)) AND ("TraitObservation"."measurementName" IS NOT NULL)) AND ("TraitObservation"."measurementName" <> ''::text)) |
|
102 |
ORDER BY btrim(concat_ws(' '::text, ifnull("TraitObservation"."taxonName", ''::text), ifnull("TraitObservation"."scientificNameAuthorship", ''::text))), "TraitObservation"."measurementName", "TraitObservation"."measurementValue"; |
|
103 |
|
|
104 |
|
|
105 |
-- |
|
106 |
-- PostgreSQL database dump complete |
|
107 |
-- |
|
108 |
|
trunk/inputs/bien2_traits/verify/validations.sql.run | ||
---|---|---|
1 |
#!/bin/bash -e |
|
2 |
. "$(dirname "${BASH_SOURCE[0]}")"/../../lib/runscripts/validations.pg.sql.run |
|
0 | 3 |
trunk/inputs/SALVIAS/verify/validations.sql | ||
---|---|---|
1 |
-- |
|
2 |
-- PostgreSQL database dump |
|
3 |
-- |
|
4 |
|
|
5 |
SET statement_timeout = 0; |
|
6 |
SET lock_timeout = 0; |
|
7 |
SET client_encoding = 'UTF8'; |
|
8 |
SET standard_conforming_strings = on; |
|
9 |
SET check_function_bodies = false; |
|
10 |
SET client_min_messages = warning; |
|
11 |
|
|
12 |
SET search_path = "SALVIAS", pg_catalog; |
|
13 |
|
|
14 |
-- |
|
15 |
-- Name: _plots_01_count_of_projects; Type: VIEW; Schema: SALVIAS; Owner: - |
|
16 |
-- |
|
17 |
|
|
18 |
CREATE OR REPLACE VIEW _plots_01_count_of_projects AS |
|
19 |
SELECT count(*) AS projects |
|
20 |
FROM projects; |
|
21 |
|
|
22 |
|
|
23 |
-- |
|
24 |
-- Name: _plots_02_list_of_project_names; Type: VIEW; Schema: SALVIAS; Owner: - |
|
25 |
-- |
|
26 |
|
|
27 |
CREATE OR REPLACE VIEW _plots_02_list_of_project_names AS |
|
28 |
SELECT projects.project_name |
|
29 |
FROM projects; |
|
30 |
|
|
31 |
|
|
32 |
-- |
|
33 |
-- Name: _plots_03_count_of_all_plots_in_this_source; Type: VIEW; Schema: SALVIAS; Owner: - |
|
34 |
-- |
|
35 |
|
|
36 |
CREATE OR REPLACE VIEW _plots_03_count_of_all_plots_in_this_source AS |
|
37 |
SELECT count(DISTINCT (pm."SiteCode")::text) AS plots |
|
38 |
FROM (projects p |
|
39 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))); |
|
40 |
|
|
41 |
|
|
42 |
-- |
|
43 |
-- Name: _plots_04_count_of_plots_in_each_project_in_this_source; Type: VIEW; Schema: SALVIAS; Owner: - |
|
44 |
-- |
|
45 |
|
|
46 |
CREATE OR REPLACE VIEW _plots_04_count_of_plots_in_each_project_in_this_source AS |
|
47 |
SELECT p.project_name, |
|
48 |
count(*) AS plots |
|
49 |
FROM (projects p |
|
50 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
51 |
GROUP BY p.project_name; |
|
52 |
|
|
53 |
|
|
54 |
-- |
|
55 |
-- Name: _plots_05_list_of_plot_codes_by_project; Type: VIEW; Schema: SALVIAS; Owner: - |
|
56 |
-- |
|
57 |
|
|
58 |
CREATE OR REPLACE VIEW _plots_05_list_of_plot_codes_by_project AS |
|
59 |
SELECT p.project_name, |
|
60 |
(pm."SiteCode")::text AS plot_code |
|
61 |
FROM (projects p |
|
62 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))); |
|
63 |
|
|
64 |
|
|
65 |
-- |
|
66 |
-- Name: _plots_06_list_of_plots_with_stem_measurements; Type: VIEW; Schema: SALVIAS; Owner: - |
|
67 |
-- |
|
68 |
|
|
69 |
CREATE OR REPLACE VIEW _plots_06_list_of_plots_with_stem_measurements AS |
|
70 |
SELECT DISTINCT p.project_name, |
|
71 |
(pm."SiteCode")::text AS plot_code |
|
72 |
FROM (((projects p |
|
73 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
74 |
JOIN "plotObservations" po ON ((pm."PlotID" = po."PlotID"))) |
|
75 |
JOIN stems s ON ((po."PlotObsID" = s.plotobs_id))) |
|
76 |
GROUP BY p.project_name, (pm."SiteCode")::text |
|
77 |
ORDER BY p.project_name, (pm."SiteCode")::text; |
|
78 |
|
|
79 |
|
|
80 |
-- |
|
81 |
-- Name: _plots_06a_list_of_stems; Type: VIEW; Schema: SALVIAS; Owner: - |
|
82 |
-- |
|
83 |
|
|
84 |
CREATE OR REPLACE VIEW _plots_06a_list_of_stems AS |
|
85 |
SELECT p.project_name, |
|
86 |
(pm."SiteCode")::text AS plot_code, |
|
87 |
(s.stem_id)::text AS stem_id |
|
88 |
FROM (((projects p |
|
89 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
90 |
JOIN "plotObservations" po ON ((pm."PlotID" = po."PlotID"))) |
|
91 |
JOIN stems s ON ((po."PlotObsID" = s.plotobs_id))) |
|
92 |
ORDER BY p.project_name, (pm."SiteCode")::text, (s.stem_id)::text; |
|
93 |
|
|
94 |
|
|
95 |
-- |
|
96 |
-- Name: _plots_07_list_of_plots_which_use_counts_of_indiv_per_species; Type: VIEW; Schema: SALVIAS; Owner: - |
|
97 |
-- |
|
98 |
|
|
99 |
CREATE OR REPLACE VIEW _plots_07_list_of_plots_which_use_counts_of_indiv_per_species AS |
|
100 |
SELECT DISTINCT p.project_name, |
|
101 |
(pm."SiteCode")::text AS plot_code |
|
102 |
FROM ((projects p |
|
103 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
104 |
JOIN "plotObservations" po ON (((pm."PlotID" = po."PlotID") AND (po."NoInd" > 1)))) |
|
105 |
GROUP BY p.project_name, (pm."SiteCode")::text |
|
106 |
ORDER BY p.project_name, (pm."SiteCode")::text; |
|
107 |
|
|
108 |
|
|
109 |
-- |
|
110 |
-- Name: _plots_08_list_of_plots_which_use_percent_cover; Type: VIEW; Schema: SALVIAS; Owner: - |
|
111 |
-- |
|
112 |
|
|
113 |
CREATE OR REPLACE VIEW _plots_08_list_of_plots_which_use_percent_cover AS |
|
114 |
SELECT DISTINCT p.project_name, |
|
115 |
(pm."SiteCode")::text AS plot_code |
|
116 |
FROM ((projects p |
|
117 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
118 |
JOIN "plotObservations" po ON (((pm."PlotID" = po."PlotID") AND (po.cover_percent IS NOT NULL)))) |
|
119 |
GROUP BY p.project_name, (pm."SiteCode")::text |
|
120 |
ORDER BY p.project_name, (pm."SiteCode")::text; |
|
121 |
|
|
122 |
|
|
123 |
-- |
|
124 |
-- Name: _plots_09_list_of_plots_which_use_line_intercept; Type: VIEW; Schema: SALVIAS; Owner: - |
|
125 |
-- |
|
126 |
|
|
127 |
CREATE OR REPLACE VIEW _plots_09_list_of_plots_which_use_line_intercept AS |
|
128 |
SELECT DISTINCT p.project_name, |
|
129 |
(pm."SiteCode")::text AS plot_code |
|
130 |
FROM ((projects p |
|
131 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
132 |
JOIN "plotObservations" po ON (((pm."PlotID" = po."PlotID") AND (po.intercept_cm IS NOT NULL)))) |
|
133 |
GROUP BY p.project_name, (pm."SiteCode")::text |
|
134 |
ORDER BY p.project_name, (pm."SiteCode")::text; |
|
135 |
|
|
136 |
|
|
137 |
-- |
|
138 |
-- Name: _plots_10_count_of_individuals_per_plot_in_each_project; Type: VIEW; Schema: SALVIAS; Owner: - |
|
139 |
-- |
|
140 |
|
|
141 |
CREATE OR REPLACE VIEW _plots_10_count_of_individuals_per_plot_in_each_project AS |
|
142 |
SELECT p.project_name, |
|
143 |
(pm."SiteCode")::text AS plot_code, |
|
144 |
sum(po."NoInd") AS individuals |
|
145 |
FROM ((projects p |
|
146 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
147 |
JOIN "plotObservations" po ON ((pm."PlotID" = po."PlotID"))) |
|
148 |
GROUP BY p.project_name, (pm."SiteCode")::text |
|
149 |
ORDER BY p.project_name, (pm."SiteCode")::text; |
|
150 |
|
|
151 |
|
|
152 |
-- |
|
153 |
-- Name: VIEW _plots_10_count_of_individuals_per_plot_in_each_project; Type: COMMENT; Schema: SALVIAS; Owner: - |
|
154 |
-- |
|
155 |
|
|
156 |
COMMENT ON VIEW _plots_10_count_of_individuals_per_plot_in_each_project IS ' |
|
157 |
Method: Sum on NoInd (number of individuals) column. |
|
158 |
Note 1: `individuals` should be NULL for plots which use percent cover or line-intercept methods. |
|
159 |
Note 2: Do not count records in plotObservations table, as this will give incorrect total for plots such as Gentry plot, which count individuals per species per subplot |
|
160 |
'; |
|
161 |
|
|
162 |
|
|
163 |
-- |
|
164 |
-- Name: _plots_10a_aggregate_observation_individual_counts; Type: VIEW; Schema: SALVIAS; Owner: - |
|
165 |
-- |
|
166 |
|
|
167 |
CREATE OR REPLACE VIEW _plots_10a_aggregate_observation_individual_counts AS |
|
168 |
SELECT p.project_name, |
|
169 |
(pm."SiteCode")::text AS plot_code, |
|
170 |
(po."PlotObsID")::text AS individual_id, |
|
171 |
po."NoInd" AS individuals |
|
172 |
FROM ((projects p |
|
173 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
174 |
JOIN "plotObservations" po ON ((pm."PlotID" = po."PlotID"))) |
|
175 |
ORDER BY p.project_name, (pm."SiteCode")::text, (po."PlotObsID")::text; |
|
176 |
|
|
177 |
|
|
178 |
-- |
|
179 |
-- Name: VIEW _plots_10a_aggregate_observation_individual_counts; Type: COMMENT; Schema: SALVIAS; Owner: - |
|
180 |
-- |
|
181 |
|
|
182 |
COMMENT ON VIEW _plots_10a_aggregate_observation_individual_counts IS ' |
|
183 |
Note 1: `individuals` should be NULL for plots which use percent cover or line-intercept methods. |
|
184 |
'; |
|
185 |
|
|
186 |
|
|
187 |
-- |
|
188 |
-- Name: _plots_11_count_of_stems_per_plot_in_each_project; Type: VIEW; Schema: SALVIAS; Owner: - |
|
189 |
-- |
|
190 |
|
|
191 |
CREATE OR REPLACE VIEW _plots_11_count_of_stems_per_plot_in_each_project AS |
|
192 |
SELECT p.project_name, |
|
193 |
(pm."SiteCode")::text AS plot_code, |
|
194 |
count(DISTINCT s.stem_id) AS stems |
|
195 |
FROM (((projects p |
|
196 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
197 |
JOIN "plotObservations" po ON ((pm."PlotID" = po."PlotID"))) |
|
198 |
JOIN stems s ON ((po."PlotObsID" = s.plotobs_id))) |
|
199 |
GROUP BY p.project_name, (pm."SiteCode")::text |
|
200 |
ORDER BY p.project_name, (pm."SiteCode")::text; |
|
201 |
|
|
202 |
|
|
203 |
-- |
|
204 |
-- Name: VIEW _plots_11_count_of_stems_per_plot_in_each_project; Type: COMMENT; Schema: SALVIAS; Owner: - |
|
205 |
-- |
|
206 |
|
|
207 |
COMMENT ON VIEW _plots_11_count_of_stems_per_plot_in_each_project IS ' |
|
208 |
Method: count records in stems table |
|
209 |
'; |
|
210 |
|
|
211 |
|
|
212 |
-- |
|
213 |
-- Name: _plots_12_count_of_verbatim_taxa_per_plot_in_each_project; Type: VIEW; Schema: SALVIAS; Owner: - |
|
214 |
-- |
|
215 |
|
|
216 |
CREATE OR REPLACE VIEW _plots_12_count_of_verbatim_taxa_per_plot_in_each_project AS |
|
217 |
SELECT a.project_name, |
|
218 |
a.plot_code, |
|
219 |
count(a.taxon) AS taxa |
|
220 |
FROM ( SELECT DISTINCT p.project_name, |
|
221 |
(pm."SiteCode")::text AS plot_code, |
|
222 |
btrim(concat_ws(' '::text, ifnull((po."Family")::text, ''::text), ifnull((po."Genus")::text, ''::text), ifnull((po."Species")::text, ''::text), if((po.infra_ep_1 IS NULL), ifnull((po.auth)::text, ''::text), btrim(concat_ws(' '::text, ifnull((po.infra_rank_1)::text, ''::text), ifnull((po.infra_ep_1)::text, ''::text), ifnull((po.infra_auth_1)::text, ''::text)))))) AS taxon |
|
223 |
FROM ((projects p |
|
224 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
225 |
JOIN "plotObservations" po ON ((pm."PlotID" = po."PlotID")))) a |
|
226 |
GROUP BY a.project_name, a.plot_code |
|
227 |
ORDER BY a.project_name, a.plot_code; |
|
228 |
|
|
229 |
|
|
230 |
-- |
|
231 |
-- Name: VIEW _plots_12_count_of_verbatim_taxa_per_plot_in_each_project; Type: COMMENT; Schema: SALVIAS; Owner: - |
|
232 |
-- |
|
233 |
|
|
234 |
COMMENT ON VIEW _plots_12_count_of_verbatim_taxa_per_plot_in_each_project IS ' |
|
235 |
Note: Assumes identical concatenation of taxonomic fields to form verbatim taxon name in vegBIEN |
|
236 |
'; |
|
237 |
|
|
238 |
|
|
239 |
-- |
|
240 |
-- Name: _plots_13_list_of_distinct_verbatim_taxa_in_each_plot_in_each_p; Type: VIEW; Schema: SALVIAS; Owner: - |
|
241 |
-- |
|
242 |
|
|
243 |
CREATE OR REPLACE VIEW _plots_13_list_of_distinct_verbatim_taxa_in_each_plot_in_each_p AS |
|
244 |
SELECT DISTINCT p.project_name, |
|
245 |
(pm."SiteCode")::text AS plot_code, |
|
246 |
btrim(concat_ws(' '::text, ifnull((po."Family")::text, ''::text), ifnull((po."Genus")::text, ''::text), ifnull((po."Species")::text, ''::text), if((po.infra_ep_1 IS NULL), ifnull((po.auth)::text, ''::text), btrim(concat_ws(' '::text, ifnull((po.infra_rank_1)::text, ''::text), ifnull((po.infra_ep_1)::text, ''::text), ifnull((po.infra_auth_1)::text, ''::text)))))) AS taxon |
|
247 |
FROM ((projects p |
|
248 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
249 |
JOIN "plotObservations" po ON ((pm."PlotID" = po."PlotID"))) |
|
250 |
ORDER BY p.project_name, (pm."SiteCode")::text, btrim(concat_ws(' '::text, ifnull((po."Family")::text, ''::text), ifnull((po."Genus")::text, ''::text), ifnull((po."Species")::text, ''::text), if((po.infra_ep_1 IS NULL), ifnull((po.auth)::text, ''::text), btrim(concat_ws(' '::text, ifnull((po.infra_rank_1)::text, ''::text), ifnull((po.infra_ep_1)::text, ''::text), ifnull((po.infra_auth_1)::text, ''::text)))))); |
|
251 |
|
|
252 |
|
|
253 |
-- |
|
254 |
-- Name: VIEW _plots_13_list_of_distinct_verbatim_taxa_in_each_plot_in_each_p; Type: COMMENT; Schema: SALVIAS; Owner: - |
|
255 |
-- |
|
256 |
|
|
257 |
COMMENT ON VIEW _plots_13_list_of_distinct_verbatim_taxa_in_each_plot_in_each_p IS ' |
|
258 |
Note: Assumes identical concatenation of taxonomic fields to form verbatim taxon name in vegBIEN. |
|
259 |
'; |
|
260 |
|
|
261 |
|
|
262 |
-- |
|
263 |
-- Name: _plots_14_count_of_indiv_per_verbatim_taxon_per_plot_in_each_pr; Type: VIEW; Schema: SALVIAS; Owner: - |
|
264 |
-- |
|
265 |
|
|
266 |
CREATE OR REPLACE VIEW _plots_14_count_of_indiv_per_verbatim_taxon_per_plot_in_each_pr AS |
|
267 |
SELECT DISTINCT p.project_name, |
|
268 |
(pm."SiteCode")::text AS plot_code, |
|
269 |
btrim(concat_ws(' '::text, ifnull((po."Family")::text, ''::text), ifnull((po."Genus")::text, ''::text), ifnull((po."Species")::text, ''::text), if((po.infra_ep_1 IS NULL), ifnull((po.auth)::text, ''::text), btrim(concat_ws(' '::text, ifnull((po.infra_rank_1)::text, ''::text), ifnull((po.infra_ep_1)::text, ''::text), ifnull((po.infra_auth_1)::text, ''::text)))))) AS taxon, |
|
270 |
sum(po."NoInd") AS individuals |
|
271 |
FROM ((projects p |
|
272 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
273 |
JOIN "plotObservations" po ON ((pm."PlotID" = po."PlotID"))) |
|
274 |
GROUP BY p.project_name, (pm."SiteCode")::text, btrim(concat_ws(' '::text, ifnull((po."Family")::text, ''::text), ifnull((po."Genus")::text, ''::text), ifnull((po."Species")::text, ''::text), if((po.infra_ep_1 IS NULL), ifnull((po.auth)::text, ''::text), btrim(concat_ws(' '::text, ifnull((po.infra_rank_1)::text, ''::text), ifnull((po.infra_ep_1)::text, ''::text), ifnull((po.infra_auth_1)::text, ''::text)))))) |
|
275 |
ORDER BY p.project_name, (pm."SiteCode")::text, btrim(concat_ws(' '::text, ifnull((po."Family")::text, ''::text), ifnull((po."Genus")::text, ''::text), ifnull((po."Species")::text, ''::text), if((po.infra_ep_1 IS NULL), ifnull((po.auth)::text, ''::text), btrim(concat_ws(' '::text, ifnull((po.infra_rank_1)::text, ''::text), ifnull((po.infra_ep_1)::text, ''::text), ifnull((po.infra_auth_1)::text, ''::text)))))); |
|
276 |
|
|
277 |
|
|
278 |
-- |
|
279 |
-- Name: VIEW _plots_14_count_of_indiv_per_verbatim_taxon_per_plot_in_each_pr; Type: COMMENT; Schema: SALVIAS; Owner: - |
|
280 |
-- |
|
281 |
|
|
282 |
COMMENT ON VIEW _plots_14_count_of_indiv_per_verbatim_taxon_per_plot_in_each_pr IS ' |
|
283 |
Note: Assumes identical concatenation of taxonomic fields to form verbatim taxon name in vegBIEN |
|
284 |
'; |
|
285 |
|
|
286 |
|
|
287 |
-- |
|
288 |
-- Name: _plots_15_pct_cover_of_each_verb_taxon_in_each_plot_in_each_pro; Type: VIEW; Schema: SALVIAS; Owner: - |
|
289 |
-- |
|
290 |
|
|
291 |
CREATE OR REPLACE VIEW _plots_15_pct_cover_of_each_verb_taxon_in_each_plot_in_each_pro AS |
|
292 |
SELECT DISTINCT p.project_name, |
|
293 |
(pm."SiteCode")::text AS plot_code, |
|
294 |
btrim(concat_ws(' '::text, ifnull((po."Family")::text, ''::text), ifnull((po."Genus")::text, ''::text), ifnull((po."Species")::text, ''::text), if((po.infra_ep_1 IS NULL), ifnull((po.auth)::text, ''::text), btrim(concat_ws(' '::text, ifnull((po.infra_rank_1)::text, ''::text), ifnull((po.infra_ep_1)::text, ''::text), ifnull((po.infra_auth_1)::text, ''::text)))))) AS taxon, |
|
295 |
sum((po.cover_percent)::double precision) AS totalpercentcover |
|
296 |
FROM ((projects p |
|
297 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
298 |
JOIN "plotObservations" po ON (((pm."PlotID" = po."PlotID") AND (po.cover_percent IS NOT NULL)))) |
|
299 |
GROUP BY p.project_name, (pm."SiteCode")::text, btrim(concat_ws(' '::text, ifnull((po."Family")::text, ''::text), ifnull((po."Genus")::text, ''::text), ifnull((po."Species")::text, ''::text), if((po.infra_ep_1 IS NULL), ifnull((po.auth)::text, ''::text), btrim(concat_ws(' '::text, ifnull((po.infra_rank_1)::text, ''::text), ifnull((po.infra_ep_1)::text, ''::text), ifnull((po.infra_auth_1)::text, ''::text)))))) |
|
300 |
ORDER BY p.project_name, (pm."SiteCode")::text, btrim(concat_ws(' '::text, ifnull((po."Family")::text, ''::text), ifnull((po."Genus")::text, ''::text), ifnull((po."Species")::text, ''::text), if((po.infra_ep_1 IS NULL), ifnull((po.auth)::text, ''::text), btrim(concat_ws(' '::text, ifnull((po.infra_rank_1)::text, ''::text), ifnull((po.infra_ep_1)::text, ''::text), ifnull((po.infra_auth_1)::text, ''::text)))))); |
|
301 |
|
|
302 |
|
|
303 |
-- |
|
304 |
-- Name: VIEW _plots_15_pct_cover_of_each_verb_taxon_in_each_plot_in_each_pro; Type: COMMENT; Schema: SALVIAS; Owner: - |
|
305 |
-- |
|
306 |
|
|
307 |
COMMENT ON VIEW _plots_15_pct_cover_of_each_verb_taxon_in_each_plot_in_each_pro IS ' |
|
308 |
Note 1: Assumes identical concatenation of taxonomic fields to form verbatim taxon name in vegbien |
|
309 |
Note 2: Grouping mean cover for entire plot allows inclusion of plots with subplots (separate cover measure for each species in each subplot), plots with strata (separate cover measures for each species in each stratum), and plots without subplots or strata (one cover measure per species per plot) in same query. |
|
310 |
Note 3: currently, there are no SALVIAS percent cover plots in BIEN |
|
311 |
'; |
|
312 |
|
|
313 |
|
|
314 |
-- |
|
315 |
-- Name: _plots_16_intercepts_for_each_verb_taxon_in_each_plot_each_proj; Type: VIEW; Schema: SALVIAS; Owner: - |
|
316 |
-- |
|
317 |
|
|
318 |
CREATE OR REPLACE VIEW _plots_16_intercepts_for_each_verb_taxon_in_each_plot_each_proj AS |
|
319 |
SELECT DISTINCT p.project_name, |
|
320 |
(pm."SiteCode")::text AS plot_code, |
|
321 |
btrim(concat_ws(' '::text, ifnull((po."Family")::text, ''::text), ifnull((po."Genus")::text, ''::text), ifnull((po."Species")::text, ''::text), if((po.infra_ep_1 IS NULL), ifnull((po.auth)::text, ''::text), btrim(concat_ws(' '::text, ifnull((po.infra_rank_1)::text, ''::text), ifnull((po.infra_ep_1)::text, ''::text), ifnull((po.infra_auth_1)::text, ''::text)))))) AS taxon, |
|
322 |
po.intercept_cm |
|
323 |
FROM ((projects p |
|
324 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
325 |
JOIN "plotObservations" po ON (((pm."PlotID" = po."PlotID") AND (po.intercept_cm IS NOT NULL)))) |
|
326 |
ORDER BY p.project_name, (pm."SiteCode")::text, btrim(concat_ws(' '::text, ifnull((po."Family")::text, ''::text), ifnull((po."Genus")::text, ''::text), ifnull((po."Species")::text, ''::text), if((po.infra_ep_1 IS NULL), ifnull((po.auth)::text, ''::text), btrim(concat_ws(' '::text, ifnull((po.infra_rank_1)::text, ''::text), ifnull((po.infra_ep_1)::text, ''::text), ifnull((po.infra_auth_1)::text, ''::text)))))); |
|
327 |
|
|
328 |
|
|
329 |
-- |
|
330 |
-- Name: VIEW _plots_16_intercepts_for_each_verb_taxon_in_each_plot_each_proj; Type: COMMENT; Schema: SALVIAS; Owner: - |
|
331 |
-- |
|
332 |
|
|
333 |
COMMENT ON VIEW _plots_16_intercepts_for_each_verb_taxon_in_each_plot_each_proj IS ' |
|
334 |
Note 1: Assumes identical concatenation of taxonomic fields to form verbatim taxon name in vegbien |
|
335 |
Note 2: Grouping mean cover for entire plot combines plots with subplots (separate cover measure for each species in each subplot) with plots with strata (separate cover measures for each species in each stratum) with plots without subplots or strata (one cover measure per species per plot. |
|
336 |
'; |
|
337 |
|
|
338 |
|
|
339 |
-- |
|
340 |
-- Name: _plots_17_count_of_subplots_per_plot_for_each_project; Type: VIEW; Schema: SALVIAS; Owner: - |
|
341 |
-- |
|
342 |
|
|
343 |
CREATE OR REPLACE VIEW _plots_17_count_of_subplots_per_plot_for_each_project AS |
|
344 |
SELECT p.project_name, |
|
345 |
(pm."SiteCode")::text AS plot_code, |
|
346 |
count(DISTINCT po."Line") AS subplots |
|
347 |
FROM ((projects p |
|
348 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
349 |
JOIN "plotObservations" po ON ((pm."PlotID" = po."PlotID"))) |
|
350 |
GROUP BY p.project_name, (pm."SiteCode")::text |
|
351 |
ORDER BY p.project_name, (pm."SiteCode")::text; |
|
352 |
|
|
353 |
|
|
354 |
-- |
|
355 |
-- Name: _plots_18_list_of_subplots_codes_for_each_plot_for_each_project; Type: VIEW; Schema: SALVIAS; Owner: - |
|
356 |
-- |
|
357 |
|
|
358 |
CREATE OR REPLACE VIEW _plots_18_list_of_subplots_codes_for_each_plot_for_each_project AS |
|
359 |
SELECT DISTINCT p.project_name, |
|
360 |
(pm."SiteCode")::text AS plot_code, |
|
361 |
po."Line" AS subplot_code |
|
362 |
FROM ((projects p |
|
363 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
364 |
JOIN "plotObservations" po ON (((pm."PlotID" = po."PlotID") AND ((pm."SiteCode")::text IS NOT NULL)))) |
|
365 |
ORDER BY p.project_name, (pm."SiteCode")::text, po."Line"; |
|
366 |
|
|
367 |
|
|
368 |
-- |
|
369 |
-- Name: VIEW _plots_18_list_of_subplots_codes_for_each_plot_for_each_project; Type: COMMENT; Schema: SALVIAS; Owner: - |
|
370 |
-- |
|
371 |
|
|
372 |
COMMENT ON VIEW _plots_18_list_of_subplots_codes_for_each_plot_for_each_project IS ' |
|
373 |
Note: includes plots with and without subplots |
|
374 |
'; |
|
375 |
|
|
376 |
|
|
377 |
-- |
|
378 |
-- Name: _plots_19_count_of_censuses_per_plot_in_each_project; Type: VIEW; Schema: SALVIAS; Owner: - |
|
379 |
-- |
|
380 |
|
|
381 |
CREATE OR REPLACE VIEW _plots_19_count_of_censuses_per_plot_in_each_project AS |
|
382 |
SELECT p.project_name, |
|
383 |
(pm."SiteCode")::text AS plot_code, |
|
384 |
count(DISTINCT ARRAY[po.census_date]) AS inventories |
|
385 |
FROM ((projects p |
|
386 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
387 |
LEFT JOIN "plotObservations" po ON (((pm."PlotID" = po."PlotID") AND ((pm."SiteCode")::text IS NOT NULL)))) |
|
388 |
GROUP BY p.project_name, (pm."SiteCode")::text |
|
389 |
ORDER BY p.project_name, (pm."SiteCode")::text; |
|
390 |
|
|
391 |
|
|
392 |
-- |
|
393 |
-- PostgreSQL database dump complete |
|
394 |
-- |
|
395 |
|
trunk/inputs/SALVIAS/verify/validations.sql.run | ||
---|---|---|
1 |
#!/bin/bash -e |
|
2 |
. "$(dirname "${BASH_SOURCE[0]}")"/../../../lib/runscripts/validations.pg.sql.run |
|
0 | 3 |
trunk/inputs/input.Makefile | ||
---|---|---|
487 | 487 |
# must be in input.Makefile instead of table.run because some datasources that |
488 | 488 |
# we validate still use old-style import |
489 | 489 |
|
490 |
validate/install: _always validations.sql/run ; |
|
490 |
# validations.sql must be in a subdir so it won't get run by sql/install |
|
491 |
validate/install: _always verify/validations.sql/run ; |
|
491 | 492 |
|
492 | 493 |
validate: _always |
493 | 494 |
echo "SELECT remake_diff_tables('$(datasrc)');"\ |
trunk/inputs/NY/verify/validations.sql | ||
---|---|---|
1 |
-- |
|
2 |
-- PostgreSQL database dump |
|
3 |
-- |
|
4 |
|
|
5 |
SET statement_timeout = 0; |
|
6 |
SET lock_timeout = 0; |
|
7 |
SET client_encoding = 'UTF8'; |
|
8 |
SET standard_conforming_strings = on; |
|
9 |
SET check_function_bodies = false; |
|
10 |
SET client_min_messages = warning; |
|
11 |
|
|
12 |
SET search_path = "NY", pg_catalog; |
|
13 |
|
|
14 |
-- |
|
15 |
-- Name: _specimens_01_count_of_total_records_specimens_in_source_db; Type: VIEW; Schema: NY; Owner: - |
|
16 |
-- |
|
17 |
|
|
18 |
CREATE VIEW _specimens_01_count_of_total_records_specimens_in_source_db AS |
|
19 |
SELECT count(*) AS "totalSpecimenRecords" |
|
20 |
FROM "Ecatalog_all"; |
|
21 |
|
Also available in: Unified diff
bugfix: inputs/input.Makefile: validations.sql must be in a subdir so it won't get run by sql/install