Skip to content

Instantly share code, notes, and snippets.

View djtfmartin's full-sized avatar

Dave Martin djtfmartin

View GitHub Profile
update species_list set is_private=true WHERE list_name REGEXP '^[0-9]' and list_type='OTHER' and is_authoritative is null;
update species_list set is_private=true WHERE list_name REGEXP '^[0-9]' and list_type='SPATIAL_PORTAL' and is_authoritative is null;
update species_list set is_private=true WHERE list_name like 'My species list%' and list_type='OTHER' and is_authoritative is null;
update species_list set is_private=true WHERE list_name = 'My species list' and list_type='SPATIAL_PORTAL' and is_authoritative is null;
update species_list set is_private=true WHERE list_name like 'My species list%' and list_type='SPATIAL_PORTAL' and is_authoritative is null;
update species_list set is_private=true WHERE list_name = 'My species list' and is_authoritative is null;
update species_list set is_private=true
WHERE
( list_name like 'My species list%'
OR list_name = 'My species list'
@djtfmartin
djtfmartin / export_of_raw_db_fields_2018-06-13.txt
Created June 13, 2018 22:29
export_of_raw_db_fields_2018-06-13.txt
_class
abcdIdentificationQualifier
abcdIdentificationQualifierInsertionPoint
abcdTypeStatus
acceptedNameUsage
associatedMedia
associatedOccurrences
associatedReferences
associatedSequences
associatedTaxa
@djtfmartin
djtfmartin / export_of_db_fields_2018-06-13.txt
Created June 13, 2018 22:26
export_of_db_fields_2018-06-13.txt
_class
_qa
abcdIdentificationQualifier
abcdIdentificationQualifier_p
abcdIdentificationQualifierInsertionPoint
abcdTypeStatus
acceptedNameUsage
associatedMedia
associatedOccurrences
associatedOccurrences_p
import groovy.json.JsonSlurper
statusUrl = new URL("http://XXXXXXXX:8983/solr/admin/collections?action=clusterstatus&wt=json")
slurper = new JsonSlurper()
json = slurper.parseText(statusUrl.text)
collectionName = "biocache"
println("Parsing")
package au.org.ala.biocache.tool
import au.org.ala.biocache.Config
import org.slf4j.LoggerFactory
object FixDatePrecision extends au.org.ala.biocache.cmd.Tool {
def cmd = "fix-date-precision"
def desc = "Cleanup old date precision values."
2017-09-20 02:07:07,477 INFO [GbifRegistryService] Updating GBIF organisation dp46: 8dda5e56-c4b4-4af2-90f9-170d9d22f2c1
2017-09-20 02:07:08,179 INFO [GbifRegistryService] Setting GBIF country of attribution to AU
2017-09-20 02:07:09,030 INFO [GbifRegistryService] Successfully updated provider in GBIF: 8dda5e56-c4b4-4af2-90f9-170d9d22f2c1
2017-09-20 02:07:09,839 INFO [GbifRegistryService] Removing contacts
2017-09-20 02:07:10,670 INFO [GbifRegistryService] Removed contact 615477
2017-09-20 02:07:10,671 INFO [GbifRegistryService] Successfully synced contacts: 8dda5e56-c4b4-4af2-90f9-170d9d22f2c1
2017-09-20 02:07:10,674 INFO [GbifRegistryService] Creating GBIF resource for dr797
2017-09-20 02:07:10,674 INFO [GbifRegistryService] Creating dataset in GBIF: null
2017-09-20 02:07:10,674 WARN [GbifRegistryService] Unable to register dataset - please check license: dr797 : Whicher Scarp Flora Survey : other
2017-09-20 02:07:10,674 INFO [GbifRegistryService] Registry key not set for resource: dr797. Not sy
create table nvc_scotland (pid integer, name varchar(255), the_geom geometry, the_geom_4326 geometry);
insert into nvc_scotland(pid, name, the_geom)
SELECT nextval('objects_id_seq'::regclass), commun_cat, ST_UNION(the_geom) FROM "65" where commun_cat='A, Aquatic Communities' GROUP BY commun_cat;
insert into nvc_scotland(pid, name, the_geom)
SELECT nextval('objects_id_seq'::regclass), commun_cat, ST_UNION(the_geom) FROM "65" where commun_cat='W, Woodlands' GROUP BY commun_cat;
# Doesnt return.....
insert into nvc_scotland(pid, name, the_geom)
delete from "65" where COMMUN_CAT IS NULL;
update "65" set COMMUN_CAT = 'A, Aquatic Communities' where COMMUN_CAT='A';
update "65" set COMMUN_CAT = 'CG, Calciolous Grassland' where COMMUN_CAT='CG';
update "65" set COMMUN_CAT = 'H, Heathland' where COMMUN_CAT='H';
update "65" set COMMUN_CAT = 'M, Mires' where COMMUN_CAT='M';
update "65" set COMMUN_CAT = 'MC, Maritime Cliff Communities' where COMMUN_CAT='MC';
update "65" set COMMUN_CAT = 'MG, Mesotrophic Grassland' where COMMUN_CAT='MG';
update "65" set COMMUN_CAT = 'N/A, Non-standard code' where COMMUN_CAT='N/A';
update "65" set COMMUN_CAT = 'S, Swamps and tall-herb fens' where COMMUN_CAT='S';
update "65" set COMMUN_CAT = 'OW, Open Water' where COMMUN_CAT='OW';
[
{
"speciesGroup": "Mammals",
"taxonRank": "order",
"taxa": [
{
"name": "DASYUROMORPHIA",
"common": "Carnivorous Marsupials"
},
{
This file has been truncated, but you can view the full file.
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">62</int>
<lst name="params">
<str name="qt">standard</str>
<str name="_stateVer_">biocache:222</str>