14.1.7. Data Output

14.1.7.1. mosaic.mdio.sqlite3MDIO module

digraph inheritance299f813db9 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "metaMDIO.metaMDIO" [URL="mosaic.meta.html#mosaic.mdio.metaMDIO.metaMDIO",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip=".. warning:: |metaclass|"]; "sqlite3MDIO.data_record" [URL="#mosaic.mdio.sqlite3MDIO.data_record",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Smart data record structure that automatically encodes/decodes data for storage"]; "sqlite3MDIO.sqlite3MDIO" [URL="#mosaic.mdio.sqlite3MDIO.sqlite3MDIO",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "metaMDIO.metaMDIO" -> "sqlite3MDIO.sqlite3MDIO" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

A class that extends metaMDIO to implement SQLite support for metadata storage.

Created:

9/28/2014

Author:

Arvind Balijepalli <arvind.balijepalli@nist.gov>

License:

See LICENSE.TXT

ChangeLog:

3/25/17 AB Allow an optional argument to pass a database name.
12/6/15 AB Add sampling frequency to analysis info table
8/5/15 AB Added a function to export database tables to CSV
8/5/15 AB Misc bug fixes
4/1/15 AB Added an estimate of data length to the DB
3/23/15 AB Added a raw query function that does not automatically decode column data.
11/9/14 AB Implemented the analysis log I/O interface for sqlite3 databases.
9/28/14 AB Initial version
class mosaic.mdio.sqlite3MDIO.data_record(data_label, data, data_t)[source]

Bases: dict

Smart data record structure that automatically encodes/decodes data for storage in a sqlite3 DB.

update([E, ]**F) None.  Update D from dict/iterable E and F.[source]

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

class mosaic.mdio.sqlite3MDIO.sqlite3MDIO[source]

Bases: metaMDIO

closeDB()[source]

Important

Abstract method: This method must be implemented by a sub-class.

csvString(query)[source]

Return database records that match the specified query as a CSV formatted string.

exportToCSV(query)[source]

Export database records that match the specified query to a CSV flat file.

queryDB(query)[source]

Important

Abstract method: This method must be implemented by a sub-class.

Query a database. :Parameters:

  • query : query string

See also

See specific implementations of metaMDIO for query syntax.

readAnalysisInfo()[source]

Important

Abstract method: This method must be implemented by a sub-class.

Read analysis information from the database.

readAnalysisLog()[source]

Important

Abstract method: This method must be implemented by a sub-class.

Read the analysis log from the database.

readSettings()[source]

Important

Abstract method: This method must be implemented by a sub-class.

Read JSON settings from the database.

writeAnalysisInfo(infolist)[source]

Important

Abstract method: This method must be implemented by a sub-class.

Write analysis information to the database. Note that subsequent calls to this method will overwrite the analysis inoformation entry in the table.

Args:
  • infolistA list of strings in the following order [ datPath, dataType, partitionAlgorithm, processingAlgorithm, filteringAlgorithm].

    datPath : full path to the data directory

    dataType : type of data processed (e.g. ABF, QDF, etc.)

    partitionAlgorithm : name of partition algorithm (e.g. eventSegment)

    processingAlgorithm : name of event processing algorithm (e.g. multStateAnalysis)

    filteringAlgorithm : name of filtering algorithm (e.g. waveletDenoiseFilter) or None if no filtering was performed.

writeAnalysisLog(analysislog)[source]

Important

Abstract method: This method must be implemented by a sub-class.

Write the analysis log string to the database. Note that subsequent calls to this method will overwrite the analysis log entry.

Args:
  • analysislog : analysis log string to save

writeRecord(data, table=None)[source]

Important

Abstract method: This method must be implemented by a sub-class.

Write data to a specified table. By default table is None. In this case sub-classes should fall back to writing data to a default table.

writeSettings(settingsstring)[source]

Important

Abstract method: This method must be implemented by a sub-class.

Write the settings JSON object to the database.

Args:
  • settingsstring : a JSON_ formatted settings string.