sampledb package

Submodules

sampledb.databasesearcher module

class sampledb.databasesearcher.DatabaseSearcher(collection)[source]

Bases: object

Seach a database.

classmethod date_range(startdate=None, enddate=None)[source]
classmethod parse_date(date)[source]

Convert a string in ‘YYYY-MM-DD’ format to a datetime object.

search(**kwargs)[source]

Search the database for entries with the specified key, value pairs. Returns a cursor with the results.

sampledb.datapublisher module

class sampledb.datapublisher.DataPublisher(collection, schema={})[source]

Bases: object

Publish data to a database.

classmethod get_SAF(filename)[source]
get_schema()[source]
classmethod parse_sheet(sheet)[source]

Converts each row in a sheet to a dictionary. Returns a list of the dictionaries.

classmethod parse_wb(wb)[source]

Converts each row in all sheets of a workbook to a dictionary. Returns a list of the dictionaries.

publish(filename)[source]

Publish a spreadsheet to the database.

sampledb.sampledatabase module

class sampledb.sampledatabase.SampleDatabase(hostname=None, db='sampleDB', collection='samples', key=None, user=None, port=8000)

Bases: object

get_schema()
classmethod load_config(config)
load_schema(schema_file)
publish(filename)
search(**kwargs)

sampledb.searchresult module

class sampledb.searchresult.SearchResult(results)[source]

Bases: object

An object containing the matching results of a search on the database.

count()[source]

Returns the number of samples that match the search.

download(filename, schema={})[source]

Download the search results as a spreadsheet.

filter(indices)[source]

Filter the search results. Returns new SearchResult with only the filtered results.

Module contents