Procedure episode template API endpoint
A reusable template that prefills a new procedure episode.
Table of contents
Endpoints
- Private portal:
https://www.brainstem.org/api/private/modules/procedureepisodetemplate/(needs a token; one record: append<id>/) - Public portal:
https://www.brainstem.org/api/public/modules/procedureepisodetemplate/(read-only, public projects, no token) - Response keys:
procedureepisodetemplate(detail, create, update),procedureepisodetemplates(list) - Permissions: inherited through
projects(fromproject)
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 200 characters. Descriptive name for this template. |
projects | list of project ids. Share with these projects. Leave empty to keep personal. |
intervention_class | one of anesthesia_only, surgical, non_surgical, euthanasia_tissue_collection, clinical_treatment, other [required] |
intervention_class_display | computed [read-only] |
protocol | protocol id; nullable |
licenses | list of license ids |
severity | choice (see the list below); nullable |
recovery_outcome | one of unknown, recovered, ongoing_recovery, non_recovery, planned_terminal, humane_endpoint, unexpected_death, aborted, cancelled [required] |
description | string; nullable |
summary | computed [read-only] |
user | user id [read-only] |
created_at | datetime [read-only]; nullable |
updated_at | datetime [read-only] |
severitychoices:eu_2010_63_non_recovery,eu_2010_63_mild,eu_2010_63_moderate,eu_2010_63_severe,uk_aspa_sub_threshold,uk_aspa_non_recovery,uk_aspa_mild,uk_aspa_moderate,uk_aspa_severe,us_iacuc_usda_no_pain_distress,us_iacuc_usda_pain_distress_relieved,us_iacuc_usda_pain_distress_unrelieved,ca_ccac_category_a,ca_ccac_category_b,ca_ccac_category_c,ca_ccac_category_d,ca_ccac_category_e,local_institutional_sub_threshold,local_institutional_non_recovery,local_institutional_mild,local_institutional_moderate,local_institutional_severe,not_applicable
List
- Allowed portals: private, public
- Request method: GET
- URL:
https://www.brainstem.org/api/private/modules/procedureepisodetemplate/ - Responses:
200OK;401Not authenticated;403Not allowed
Use example (Python API tool)
resp = client.load('procedureepisodetemplate', load_all=True)
records = resp['procedureepisodetemplates']
Use example (MATLAB API tool)
resp = client.load('procedureepisodetemplate', 'load_all', true);
records = resp.procedureepisodetemplates;
Response example
{
"procedureepisodetemplates": [
{
"id": "<id>",
"name": "Procedure episode template 1",
"projects": [
"<project-id>"
],
"intervention_class": "anesthesia_only",
"intervention_class_display": null,
"protocol": "<protocol-id>",
"licenses": [
"<license-id>"
],
"severity": "eu_2010_63_non_recovery",
"recovery_outcome": "unknown",
"description": "",
"summary": null,
"user": "<user-id>",
"created_at": "2024-03-22T10:30:00Z",
"updated_at": "2024-03-22T10:30:00Z"
}
],
"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/modules/procedureepisodetemplate/ - 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('procedureepisodetemplate', data={"name": "Procedure episode template 1", "intervention_class": "anesthesia_only", "recovery_outcome": "unknown"})
record = resp.json()['procedureepisodetemplate']
Use example (MATLAB API tool)
created = client.save(struct('name', 'Procedure episode template 1', 'intervention_class', 'anesthesia_only', 'recovery_outcome', 'unknown'), 'procedureepisodetemplate');
record = created.procedureepisodetemplate;
Detail
- Allowed portals: private, public
- Request method: GET
- URL:
https://www.brainstem.org/api/private/modules/procedureepisodetemplate/<id>/ - Responses:
200OK;403Not allowed;404Not found
Use example (Python API tool)
resp = client.load('procedureepisodetemplate', id='<id>')
record = resp.json()['procedureepisodetemplate']
Use example (MATLAB API tool)
out = client.load('procedureepisodetemplate', 'id', '<id>');
record = out.procedureepisodetemplate;
Response example
{
"procedureepisodetemplate": {
"id": "<id>",
"name": "Procedure episode template 1",
"projects": [
"<project-id>"
],
"intervention_class": "anesthesia_only",
"intervention_class_display": null,
"protocol": "<protocol-id>",
"licenses": [
"<license-id>"
],
"severity": "eu_2010_63_non_recovery",
"recovery_outcome": "unknown",
"description": "",
"summary": null,
"user": "<user-id>",
"created_at": "2024-03-22T10:30:00Z",
"updated_at": "2024-03-22T10:30:00Z"
}
}
Change
- Allowed portals: private
- Request method: PATCH
- URL:
https://www.brainstem.org/api/private/modules/procedureepisodetemplate/<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('procedureepisodetemplate', id='<id>', data={"name": "Procedure episode template 1 (renamed)"})
Use example (MATLAB API tool)
client.save(struct('id', '<id>', 'name', 'Procedure episode template 1 (renamed)'), 'procedureepisodetemplate', 'method', 'patch');
Delete
- Allowed portals: private
- Request method: DELETE
- URL:
https://www.brainstem.org/api/private/modules/procedureepisodetemplate/<id>/ - Responses:
204Deleted;400Still referenced by other records;403Not allowed;404Not found
Use example (Python API tool)
resp = client.delete('procedureepisodetemplate', id='<id>')
Use example (MATLAB API tool)
client.delete('<id>', 'procedureepisodetemplate');