model

class overture_song.model.ApiConfig(server_url: str, study_id: str, access_token: str, debug: bool = False)[source]

Configuration object for the SONG Api

Parameters:
  • server_url (str) – URL of a running song-server
  • study_id (str) – StudyId to interact with
  • access_token (str) – access token used to authorize the song-server api
  • debug (bool) – Enable debug mode
debug = False
class overture_song.model.FileUpdateRequest[source]

Mutable request object used to update file data.

Parameters:
  • file_md5 (str) – MD5 checksum value to update
  • file_size (int) – File size (bytes) to update
  • file_access (int) – Access type to update
  • file_info (dict) – json info metadata to update
fileAccess = None
fileMd5sum = None
fileSize = None
info = None
class overture_song.model.Manifest(analysis_id, manifest_entries=None)[source]

Object representing the contents of a manifest file

Parameters:
  • analysis_id (str) – analysisId associated with a collection of ManifestEntry
  • manifest_entries (List[ManifestEntry] or None) – optionally initialize a manifest with an existing list of ManifestEntry
add_entry(manifest_entry)[source]

Add a ManifestEntry to this manifest

Parameters:manifest_entry (ManifestEntry) – entry to add
Returns:None
write(output_file_path, overwrite=False)[source]

Write this manifest entry to a file

Parameters:
  • output_file_path (str) – output file to write to
  • overwrite (boolean) – if true, overwrite the file if it exists
Raises:

SongClientException – throws this exception if the file exists and overwrite is False

Returns:

None

class overture_song.model.ManifestEntry(fileId: str, fileName: str, md5sum: str)[source]

Represents a line in the manifest file pertaining to a file. The string representation of this object is the TSV of the 3 field values

Parameters:
  • fileId (str) – ObjectId of the file
  • fileName (str) – name of the file. Should not include directories
  • md5sum (str) – MD5 checksum of the file
classmethod create_manifest_entry(input_dir, data)[source]

Creates a ManifestEntry object

Parameters:data – Any object with members named ‘objectId’, ‘fileName’, ‘fileMd5sum’.
Returns:ManifestEntry object
class overture_song.model.ServerErrors[source]

Server error definitions used for classifying SongErrors

STUDY_ID_DOES_NOT_EXIST = 1
get_error_id()[source]

Get the error id for this error :return string

resolve_server_error = <bound method ServerErrors.resolve_server_error of <enum 'ServerErrors'>>[source]
exception overture_song.model.SongError(errorId: str, httpStatusName: str, httpStatusCode: int, message: str, requestUrl: str, debugMessage: str, timestamp: str, stackTrace: tuple = <factory>)[source]

Object containing data related to a song server error

Parameters:
  • errorId (str) – The id for the song server error. Used to give more meaning to errors instead of just using http status codes.
  • httpStatusName (str) – Standard http status name for a http status code
  • httpStatusCode (int) – Standard http status code
  • message (str) – Text describing the error
  • requestUrl (str) – The request url that caused this error
  • debugMessage (str) – Additional text describing the error
  • timestamp (str) – Epoch time of when this error occurred
  • stackTrace (tuple) – Server stacktrace of this error
classmethod create_song_error(data)[source]

Creates a new song error object. Used to convert a json/dict server error response to a python object

Parameters:data (dict) – input dictionary containing all the fields neccessary to create a song server error
Return type:SongError
classmethod get_field_names()[source]

Get the field names associated with a SongError

Return type:List[str]
classmethod is_song_error(data)[source]

Determine if the input dictionary contains all the fields defined in a SongError

Parameters:data (dict) – input dictionary containing all the fields neccessary to create a song server error
Returns:true if the data contains all the fields, otherwise false
Return type:boolean