1 |
10245
|
aaronmk
|
SELECT util.search_path_append('util');
|
2 |
7249
|
aaronmk
|
|
3 |
10245
|
aaronmk
|
SELECT create_if_not_exists($$CREATE INDEX "Specimen.acronym" ON $$||:table_str||$$ (acronym)$$);
|
4 |
|
|
|
5 |
10330
|
aaronmk
|
SELECT create_if_not_exists($$CREATE INDEX "Specimen.acronym" ON $$||:table_str||$$ (acronym )$$);
|
6 |
|
|
SELECT create_if_not_exists($$CREATE INDEX "Specimen.coll_year" ON $$||:table_str||$$ (coll_year )$$);
|
7 |
|
|
SELECT create_if_not_exists($$CREATE INDEX "Specimen.country_verbatim" ON $$||:table_str||$$ (country_verbatim )$$);
|
8 |
|
|
SELECT create_if_not_exists($$CREATE INDEX "Specimen.longitude_deg_verbatim" ON $$||:table_str||$$ (longitude_deg_verbatim)$$);
|
9 |
|
|
|
10 |
|
|
-- remove frameshifted rows
|
11 |
|
|
-- rerun time: 6 s ("Time: 5537.211 ms") thanks to index
|
12 |
|
|
DELETE FROM :table
|
13 |
|
|
WHERE
|
14 |
|
|
acronym IS NULL
|
15 |
|
|
OR coll_year !~ E'^(?:1[7-9]|20)\\d{2}$'
|
16 |
|
|
OR country_verbatim ~ E'\\d'
|
17 |
|
|
OR (longitude_deg_verbatim ~ E'[[:alpha:]]' AND longitude_deg_verbatim NOT IN ('RESTRINGIDO'))
|
18 |
|
|
;
|
19 |
|
|
|
20 |
7249
|
aaronmk
|
-- Remove institutions that we have direct data for
|
21 |
|
|
DELETE FROM :table
|
22 |
|
|
WHERE acronym IN (
|
23 |
7250
|
aaronmk
|
-- Comments are from e-mail from Brad Boyle on 2013-1-16
|
24 |
|
|
'MO' -- "all MO records in REMIB are also available from MO's own website"
|
25 |
|
|
--, 'ARIZ' -- Some REMIB ARIZ specimens not yet in ARIZ itself
|
26 |
|
|
--, 'NY' -- Some REMIB NY specimens not yet in NY itself
|
27 |
9502
|
aaronmk
|
, 'TEX'
|
28 |
7249
|
aaronmk
|
)
|
29 |
9502
|
aaronmk
|
/* list obtained using the following on r9459:
|
30 |
9501
|
aaronmk
|
SELECT DISTINCT dataprovider
|
31 |
7249
|
aaronmk
|
FROM sourcelist
|
32 |
9501
|
aaronmk
|
JOIN provider_count ON provider_count.dataprovider = sourcelist.name
|
33 |
7249
|
aaronmk
|
WHERE source_id = source_by_shortname('REMIB')
|
34 |
9501
|
aaronmk
|
ORDER BY dataprovider
|
35 |
7249
|
aaronmk
|
*/
|
36 |
|
|
;
|