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

  1. Endpoints
  2. Fields
  3. List
  4. Add
  5. Detail
  6. Change
  7. Delete
  8. Data model

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 (from project)
  • Uniqueness: name unique across BrainSTEM
  • Schema payload: type selects a SpecimenSet type; send its fields in details. type_schema_version is set by the server; do not send it.
  • Deleting: also deletes the linked experimentalinterface, specimen, specimenlog, specimenprocedure records

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.

FieldDescription
idUUID string [read-only]
namestring [required]; max 100 characters
typeone of the SpecimenSet types [required]
baseline_conditionsJSON object. Processing the material had already undergone when this set was created, for example fixed by perfusion before extraction.
preparation_conditionsJSON object [read-only]
statusone of planned, available, in_use, reserved, consumed, discarded, lost [required]. Current availability status of this specimen set.
qualityone of excellent, good, fair, poor, not_assessed. Overall quality assessment for this specimen set.
item_countnumber; nullable. Total number of items in the set. Useful when individual specimens are not tracked.
subjectsubject id; nullable; nestable. Subject this specimen set was derived from, if applicable.
source_specimen_setspecimenset id; nullable; nestable. Specimen set this set was derived from.
projectslist of project ids [required]; nestable
target_regionslist of anatomicalregion ids
preparation_datetimedatetime; nullable. Date and time when this specimen set was prepared.
termination_datetimedatetime; nullable. Date and time when this specimen set was consumed, discarded, or otherwise terminated.
storage_locationstring; max 100 characters; nullable. Current physical storage location, container, or slot.
storage_conditionsstring; max 100 characters; nullable. Current storage conditions, such as temperature and medium.
detailsJSON object
type_schema_versionstring [set by the server]
extra_content_jsonJSON object; nullable
descriptionstring; nullable
tagslist of strings; filter with filter{tags.name}=<name>
specimenprocedureslist of specimenprocedure ids [read-only]; nullable; nestable
specimenlogslist 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: 200 OK; 401 Not authenticated; 403 Not 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: 201 Created; 400 Bad request (validation errors per field); 403 Not 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: 200 OK; 403 Not allowed; 404 Not 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: 200 OK; 400 Bad request; 403 Not allowed; 404 Not 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: 204 Deleted; 400 Still referenced by other records; 403 Not allowed; 404 Not 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.