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