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
API¶
-
GET
/samples/{uuid}
¶ Find a sample by uuid
Returns a sample with specific uuid
- Parameters
uuid (string) – Globally unique ID
- Status Codes
200 OK – successful operation
400 Bad Request – Invalid uuid supplied
404 Not Found – sample not found
-
PUT
/samples/{uuid}
¶ Update an existing sample
- Parameters
uuid (string) – Globally unique ID
- Status Codes
400 Bad Request – Invalid ID supplied
404 Not Found – Sample not found
405 Method Not Allowed – Validation exception
-
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
200 OK – successful operation
400 Bad Request – Invalid uuid supplied
404 Not Found – Revisons not found
-
POST
/samples/new
¶ Create a new sample
- Status Codes
200 OK – successful operation
400 Bad Request – Invalid ID supplied
-
POST
/samples
¶ Search samples using a Mongo query
- Status Codes
200 OK – successful operation
405 Method Not Allowed – Invalid input