Skip to content

Instantly share code, notes, and snippets.

View eightysteele's full-sized avatar

Aaron Steele eightysteele

View GitHub Profile
def add_dynamic_properties(input_dict, instance, bulkload_state_copy):
for key,value in input_dict.iteritems():
if key in PROPERTIES_STOP_CONCEPTS:
continue
try:
instance[key] = value.lower()
except:
pass
instance.pop('rechash')
instance.pop('reckey')
>>> sp = []
>>> for x in props.split('\n'):
... if x.split()[0] == 'X':
... sp.append(x.split()[1].lower())
...
>>> sp.sort()
>>> sp
STOP_CONCEPTS = ['acceptednameusageid', 'accessrights', 'basisofrecord', 'collectionid', 'coordinateprecision', 'coordinateuncertaintyinmeters', 'datasetid', 'dateidentified', 'day', 'decimallatitude', 'decimallongitude', 'disposition', 'enddayofyear', 'eventdate', 'eventid', 'eventtime', 'fieldnotes', 'footprintspatialfit', 'footprintsrs', 'footprintwkt', 'geologicalcontextid', 'georeferenceremarks', 'georeferenceverificationstatus', 'highergeographyid', 'identificationid', 'individualcount', 'individualid', 'institutionid', 'language', 'locationid', 'maximumdepthinmeters', 'maximumdistanceabovesurfaceinmeters', 'maximumelevationinmeters', 'minimumdepthinmeters', 'minimumdistanceabovesurfaceinmeters', 'minimumelevationinmeters', 'modified', 'month', 'nameaccordingtoid', 'namepublishedinid', 'nomenclaturalcode', 'occurrencedetails', 'occurrenceid', 'originalnameusageid', 'parentnameusageid', 'pointradiusspatialfit', 'rights', 'rightsholder', 'scientificnameid', 'startdayofyear', 'taxonconceptid', 'taxonid', '
STOP_WORDS = ['a', 'able', 'about', 'across', 'after', 'all', 'almost', 'also', 'am', 'among', 'an', 'and', 'any', 'are', 'as', 'at', 'be', 'because', 'been', 'but', 'by', 'can', 'cannot', 'could', 'dear', 'did', 'do', 'does', 'either', 'else', 'ever', 'every', 'for', 'from', 'get', 'got', 'had', 'has', 'have', 'he', 'her', 'hers', 'him', 'his', 'how', 'however', 'i', 'if', 'in', 'into', 'is', 'it', 'its', 'just', 'least', 'let', 'like', 'likely', 'may', 'me', 'might', 'most', 'must', 'my', 'neither', 'no', 'nor', 'not', 'of', 'off', 'often', 'on', 'only', 'or', 'other', 'our', 'own', 'rather', 'said', 'say', 'says', 'she', 'should', 'since', 'so', 'some', 'than', 'that', 'the', 'their', 'them', 'then', 'there', 'these', 'they', 'this', 'tis', 'to', 'too', 'twas', 'us', 'wants', 'was', 'we', 'were', 'what', 'when', 'where', 'which', 'while', 'who', 'whom', 'why', 'will', 'with', 'would', 'yet', 'you', 'your']
@eightysteele
eightysteele / gist:1126818
Created August 5, 2011 02:33
WorldClim Metadata
variable,name,value
tmin3,DatabaseName,WorldClim
tmin3,Version,1.4
tmin3,Release,3
tmin3,Created,20060104
tmin3,Projection,GEOGRAPHIC
tmin3,Datum,WGS84
tmin3,MinX,30
tmin3,MaxX,60
tmin3,MinY,-30
function(doc) {
emit(doc._id, {rev:doc._rev, coords:doc.coords, varvals:doc.vars});
}
@eightysteele
eightysteele / gist:1116099
Created July 30, 2011 22:43
MapReduce results over MasterSearchIndex: errortype,MSI.term,count
noparent,(tuberculosus),1
noparent,55,1
noparent,?,1
noparent,[abbotti],1
noparent,aaptus,1
noparent,aardvark,1
noparent,aba roundleaf bat,1
noparent,abae,1
noparent,abaxillare,1
noparent,abbotti,2
@eightysteele
eightysteele / gist:1108715
Created July 27, 2011 05:00
VertNet bulkloader payload example
{
"publishers":[ // List of publishers
{
"key_urlsafe":"asdfLKJDldglkjdgD",
"collections":[ // List of publisher collections
{
"key_urlsafe":"asdfLKJDldglkjdgD",
"records":[ // List of collection records
{
"key_urlsafe":"agFfckELEglQdWJsaXNoZ",
@eightysteele
eightysteele / gist:1079737
Created July 13, 2011 04:52
Record example
class Record(model.Model):
collections = model.StringProperty('c', repeated=True)
var event = new MOL.env.events.LocationEvent({}, 'get-url');
MOL.app.getBus().addHandler(
"LocationEvent",
function(event){
if (event.getAction() == 'take-url') {
alert(event.getLocation().url);
}
}
);