Specimen set API endpoint
Tissue or cultures prepared together, such as a slice series or a well plate, usually taken from a subject.
Table of contents
Endpoints
- Private portal:
https://www.brainstem.org/api/private/stem/specimenset/(needs a token; one record: append<id>/) - Public portal:
https://www.brainstem.org/api/public/stem/specimenset/(read-only, public projects, no token) - Response keys:
specimenset(detail, create, update),specimensets(list) - Permissions: inherited through
projects(fromproject) - Uniqueness:
nameunique across BrainSTEM - Schema payload:
typeselects a SpecimenSet type; send its fields indetails.type_schema_versionis set by the server; do not send it. - Deleting: also deletes the linked
experimentalinterface,specimen,specimenlog,specimenprocedurerecords
Fields
[required] fields must be sent on create; [read-only] fields are returned but cannot be set. A nestable relation can be traversed in filters (filter{field.other}) and sideloaded with include[]=field.*; other relations can only be compared with ids (filter{field}=<id>). See the query syntax.
| Field | Description |
|---|---|
id | UUID string [read-only] |
name | string [required]; max 100 characters |
type | one of the SpecimenSet types [required] |
baseline_conditions | JSON object. Processing the material had already undergone when this set was created, for example fixed by perfusion before extraction. |
preparation_conditions | JSON object [read-only] |
status | one of planned, available, in_use, reserved, consumed, discarded, lost [required]. Current availability status of this specimen set. |
quality | one of excellent, good, fair, poor, not_assessed. Overall quality assessment for this specimen set. |
item_count | number; nullable. Total number of items in the set. Useful when individual specimens are not tracked. |
subject | subject id; nullable; nestable. Subject this specimen set was derived from, if applicable. |
source_specimen_set | specimenset id; nullable; nestable. Specimen set this set was derived from. |
projects | list of project ids [required]; nestable |
target_regions | list of anatomicalregion ids |
preparation_datetime | datetime; nullable. Date and time when this specimen set was prepared. |
termination_datetime | datetime; nullable. Date and time when this specimen set was consumed, discarded, or otherwise terminated. |
storage_location | string; max 100 characters; nullable. Current physical storage location, container, or slot. |
storage_conditions | string; max 100 characters; nullable. Current storage conditions, such as temperature and medium. |
details | JSON object |
type_schema_version | string [set by the server] |
extra_content_json | JSON object; nullable |
description | string; nullable |
tags | list of strings; filter with filter{tags.name}=<name> |
specimenprocedures | list of specimenprocedure ids [read-only]; nullable; nestable |
specimenlogs | list of specimenlog ids [read-only]; nullable; nestable |
List
- Allowed portals: private, public
- Request method: GET
- URL:
https://www.brainstem.org/api/private/stem/specimenset/ - Responses:
200OK;401Not authenticated;403Not allowed
Use example (Python API tool)
resp = client.load('specimenset', load_all=True)
records = resp['specimensets']
Use example (MATLAB API tool)
resp = client.load('specimenset', 'load_all', true);
records = resp.specimensets;
Response example
{
"specimensets": [
{
"id": "<id>",
"name": "Specimen set 1",
"type": "WholeTissue",
"baseline_conditions": {},
"preparation_conditions": {},
"status": "available",
"quality": "excellent",
"item_count": 1,
"subject": "<subject-id>",
"source_specimen_set": "<specimenset-id>",
"projects": [
"<project-id>"
],
"target_regions": [
"<anatomicalregion-id>"
],
"preparation_datetime": "2024-03-22T10:30:00Z",
"termination_datetime": "2024-03-22T10:30:00Z",
"storage_location": "",
"storage_conditions": "",
"details": {
"...": "see the schema of the selected type"
},
"type_schema_version": "set by the server",
"extra_content_json": {},
"description": "",
"tags": [],
"specimenprocedures": [
"<specimenprocedure-id>"
],
"specimenlogs": [
"<specimenlog-id>"
]
}
],
"meta": {
"page": 1,
"per_page": 100,
"total_results": 1,
"total_pages": 1
}
}
Add
- Allowed portals: private
- Request method: POST
- URL:
https://www.brainstem.org/api/private/stem/specimenset/ - Data: JSON object with at least the required fields
- Responses:
201Created;400Bad request (validation errors per field);403Not allowed
Use example (Python API tool)
resp = client.save('specimenset', data={"name": "Specimen set 1", "type": "Array", "status": "available", "projects": ["<project-id>"], "details": {"...": "see the schema of the selected type"}})
record = resp.json()['specimenset']
Use example (MATLAB API tool)
created = client.save(struct('name', 'Specimen set 1', 'type', 'Array', 'status', 'available', 'projects', {{'<project-id>'}}, 'details', struct()), 'specimenset'); % struct() stands for the fields of the selected type
record = created.specimenset;
Detail
- Allowed portals: private, public
- Request method: GET
- URL:
https://www.brainstem.org/api/private/stem/specimenset/<id>/ - Responses:
200OK;403Not allowed;404Not found
Use example (Python API tool)
resp = client.load('specimenset', id='<id>')
record = resp.json()['specimenset']
Use example (MATLAB API tool)
out = client.load('specimenset', 'id', '<id>');
record = out.specimenset;
Response example
{
"specimenset": {
"id": "<id>",
"name": "Specimen set 1",
"type": "WholeTissue",
"baseline_conditions": {},
"preparation_conditions": {},
"status": "available",
"quality": "excellent",
"item_count": 1,
"subject": "<subject-id>",
"source_specimen_set": "<specimenset-id>",
"projects": [
"<project-id>"
],
"target_regions": [
"<anatomicalregion-id>"
],
"preparation_datetime": "2024-03-22T10:30:00Z",
"termination_datetime": "2024-03-22T10:30:00Z",
"storage_location": "",
"storage_conditions": "",
"details": {
"...": "see the schema of the selected type"
},
"type_schema_version": "set by the server",
"extra_content_json": {},
"description": "",
"tags": [],
"specimenprocedures": [
"<specimenprocedure-id>"
],
"specimenlogs": [
"<specimenlog-id>"
]
}
}
Change
- Allowed portals: private
- Request method: PATCH
- URL:
https://www.brainstem.org/api/private/stem/specimenset/<id>/ - Data: JSON object with the fields to change. Lists (
projects,tags, …) and JSON payloads (details, coordinates) are replaced as a whole: read the record first and send the full list or object. - Responses:
200OK;400Bad request;403Not allowed;404Not found
Use example (Python API tool)
resp = client.save('specimenset', id='<id>', data={"name": "Specimen set 1 (renamed)"})
Use example (MATLAB API tool)
client.save(struct('id', '<id>', 'name', 'Specimen set 1 (renamed)'), 'specimenset', 'method', 'patch');
Delete
- Allowed portals: private
- Request method: DELETE
- URL:
https://www.brainstem.org/api/private/stem/specimenset/<id>/ - Responses:
204Deleted;400Still referenced by other records;403Not allowed;404Not found
Use example (Python API tool)
resp = client.delete('specimenset', id='<id>')
Use example (MATLAB API tool)
client.delete('<id>', 'specimenset');
Data model
The fields are described for the web forms on the Specimen set data model page.