Project

General

Profile

1
SELECT util.search_path_append('util');
2

    
3
SELECT create_if_not_exists($$CREATE INDEX "Specimen.acronym" ON $$||:table_str||$$ (acronym)$$);
4

    
5
-- remove frameshifted rows
6
-- rerun time: 6 s ("Time: 5537.211 ms") thanks to index
7
DELETE FROM :table WHERE acronym IS NULL;
8
DELETE FROM :table WHERE coll_year !~ '^(?:1[7-9]|20)\d{2}$';
9
DELETE FROM :table WHERE country ~ '\d';
10
DELETE FROM :table WHERE long_deg ~ '[[:alpha:]]' AND long_deg NOT IN ('RESTRINGIDO');
11
DELETE FROM :table WHERE long_min !~ '^\d*$';
12
DELETE FROM :table WHERE long_sec !~ '^\d*$';
13
DELETE FROM :table WHERE lat_min  !~ '^\d*$';
14
DELETE FROM :table WHERE lat_sec  !~ '^\d*$';
15

    
16
-- Remove institutions that we have direct data for
17
DELETE FROM :table
18
WHERE acronym IN (
19
    -- Comments are from e-mail from Brad Boyle on 2013-1-16
20
    'MO' -- "all MO records in REMIB are also available from MO's own website"
21
    --, 'ARIZ' -- Some REMIB ARIZ specimens not yet in ARIZ itself
22
    --, 'NY' -- Some REMIB NY specimens not yet in NY itself
23
    , 'TEX'
24
)
25
/* list obtained using the following on r9459:
26
SELECT DISTINCT dataprovider
27
FROM sourcelist
28
JOIN provider_count ON provider_count.dataprovider = sourcelist.name
29
WHERE source_id = source_by_shortname('REMIB')
30
ORDER BY dataprovider
31
*/
32
;
(7-7/9)