Reference

Clients

class amostra.http_client.Client(url)[source]

This connects to an amostra HTTP server for sample management.

For each collection, we have a traitlets-based object to represent documents from that collection and automatically sync any changes back to the server to verify that they are valid and, if so, persist them in the database.

Connect to an amostra HTTP server.

Parameters
url: string
property containers

Accessor for creating and searching Containers

property samples

Accessor for creating and searching Samples

class amostra.mongo_client.Client(database)[source]

This connects to several MongoDB collections for sample management.

For each collection, we have a traitlets-based object to represent documents from that collection and automatically sync any changes back to the database.

Each collection has a counterpart named {collection_name}_revisions that stores previous version of the document. This approach was inspired by: https://www.mongodb.com/blog/post/building-with-patterns-the-document-versioning-pattern

Connect to a MongoDB datbase.

Parameters
database: pymongo.Database or URI string
property containers

Accessor for creating and searching Containers

property samples

Accessor for creating and searching Samples

Objects Representing Documents

None of these should be directly instanted by the user; they should be returned by a Client.

class amostra.objects.Sample(_amostra_client, *, name, **kwargs)[source]

This object should not be directly instantiated by this user. Use a client.

Parameters
_amostra_client: Client

The name is intended to avoid name collisions with any future sample traits.

name: string

A required Sample trait

**kwargs

Other, optional sample traits

class amostra.objects.Container(_amostra_client, *, name, kind, contents)[source]

This object should not be directly instantiated by this user. Use a client.

Parameters
_amostra_client: Client

The name is intended to avoid name collisions with any future sample traits.

**kwargs

Other, optional sample traits

classmethod from_document(amostra_client, document)[source]

Convert a dict returned by the server to our traitlets-based object.

to_dict(self)[source]

Represent the object as a JSON-serializable dictionary.

class amostra.objects.Project(_amostra_client, *args, **kwargs)[source]
class amostra.objects.Owner(_amostra_client, *args, **kwargs)[source]
class amostra.objects.Institution(_amostra_client, *args, **kwargs)[source]

API

GET /samples/{uuid}

Find a sample by uuid

Returns a sample with specific uuid

Parameters
  • uuid (string) – Globally unique ID

Status Codes
PUT /samples/{uuid}

Update an existing sample

Parameters
  • uuid (string) – Globally unique ID

Status Codes
GET /samples/{uuid}/revisions

Find revisions of a sample by uuid

Returns revisons of a sample with specific uuid

Parameters
  • uuid (string) – Globally unique ID

Status Codes
POST /samples/new

Create a new sample

Status Codes
POST /samples

Search samples using a Mongo query

Status Codes