8. API

8.1. Table

The Table API provides a number of REST calls that operate on a server held state that describes a table. After a number of table definition updates have been done, the user can request a portion of the table.

class ResourceTable(request, context=None)
collection_get()

/table

User interface showing table setup and data.

Returns:

HTML

class ResourceTableFilter(request, context=None)
get()

/api/v1/table/filter/{filter_id}

Get filter identified by filter_id.

Parameters:

filter_id – Identifier of the filter.

Returns:

Filter identified by filter_id. Example: [{“id”: 1, “text”: “Determined”}, {“id”: 2, “text”: “< 3”}, {“id”: 3, “text”: “3-5”}, {“id”: 4, “text”: “5-10”}, {“id”: 5, “text”: “>= 10”}]

class ResourceTableState(request, context=None)
get()

/api/v1/table/state

Get the active table.

Returns:

Active table. Example: {“poprow”: {}, “count”: 3, “page”: 1, “pages”: 1, “rows”: [[1, “257333”, “12-08-1901”], [2, “443871”, “20-05-1972”], [3, “210487”, “18-05-1962”]], “action_ids”: [null, null, null], “filters”: “acq_score 1”, “preset”: {“id”: 1, “name”: “All patients”, “description”: “Overview of all patients”, “ref”: “PATIENT_OVERVIEW”, “group_id”: null, “user_id”: null, “public”: true, “predefined”: true, “category”: 7, “visibility”: “Public presets”, “custom”: true, “type”: “flat”, “breadcrumb”: [[3, “Public presets”], [7, “Patientlists”]], “path”: “Public presets, Patientlists”}, “header”: [{“id”: “_rownumber”, “name”: “No.”, “description”: “Row number”, “sort”: null, “align”: “right”, “decimals”: 0, “kind”: “”}, {“id”: “patient_id”, “name”: “Patientnumber”, “description”: “Patientnumber”, “sort”: null, “align”: “right”, “decimals”: “”, “kind”: “”}, {“id”: “patient_birthdate”, “name”: “Birthdate”, “description”: “Birthdate”, “sort”: null, “align”: “right”, “decimals”: “”, “kind”: “”}], “pagenumbers”: [1], “showing”: “Showing 1 to 3 of 3 rows”, “action_function”: null}

class ResourceTableStateColumn(request, context=None)
delete()

/api/v1/table/state/column

Delete the active columns.

Returns:

[]

get()

/api/v1/table/state/column

Get list of all columns. Optionally, the list is sorted by how well its items match given keyword(s).

Parameters:

q – Keyword(s) to search for (separated by spaces).

Returns:

List of columns. Example: [{“id”: “patient_id”, “text”: “Patientnumber”, “selected”: true}, {“id”: “patient_name”, “text”: “Patientname”, “selected”: true}]

class ResourceTableStateColumnOrder(request, context=None)
put()

/api/v1/table/state/column/order

Set a new column ordering.

Parameters:

values – List of column names. Example: [“result_smoking”, “result_acq”]

Returns:

True

class ResourceTableStateColumnSort(request, context=None)
put()

/api/v1/table/state/column/sort/{column_id}

Toggle the sort ordering for a column (switch between no sorting, ascending and descending).

Parameters:

column_id – Identifier of the column.

Returns:

True

class ResourceTableStateColumnToggle(request, context=None)
put()

/api/v1/table/state/column/toggle/{column_id}

Toggle column (switch between active and inactive).

Parameters:

column_id – Identifier of the column.

Returns:

True

class ResourceTableStateFilter(request, context=None)
collection_get()

/api/v1/table/state/filter

Get list of active (i.e. selected) filters.

Returns:

List of filters. Example: [{“id”: “acq_score”, “text”: “ACQ Score”, “description”: “ACQ Score”, “selected”: [{“id”: 4, “text”: “1”}], “userexpr”: true}]

put()

/api/v1/table/state/filter/{filter_id}

Set a number of valid values for a particular filter.

Parameters:
  • filter_id – Identifier of the filter.

  • values – List of filter values. Example: [“5”, “7”]

Returns:

True

class ResourceTableStateFilterexpr(request, context=None)
put()

/api/v1/table/state/filterexpr/{filter_id}/{expression}

Add a user expression.

Parameters:
  • filter_id – Identifier of the filter.

  • expression – User expression. Example for value greater than 3: %3C%203

Returns:

Index of user expression in filter if user expression is valid, else None

class ResourceTableStateFiltersInactive(request, context=None)
collection_get()

/api/v1/table/state/filters/inactive

Get list of all inactive filters.

Returns:

List of filters. Example: [{“id”: “result_acq”, “text”: “ACQ Score”, “selected”: false}, {“id”: “result_acq_timestamp”, “text”: “ACQ Score, last measurement”, “selected”: false}]

class ResourceTableStateGroupAggregate(request, context=None)
put()

/api/v1/table/state/group/aggregate/{column_id}/{index}

Set group aggregate.

Parameters:
  • column_id – Identifier of the column.

  • index – Index of the aggregate.

Returns:

True

class ResourceTableStateGroupData(request, context=None)
delete()

/api/v1/table/state/group/data

Delete the active group data fields.

Returns:

[]

get()

/api/v1/table/state/group/data

Get list of group data fields.

Optionally, the list is filtered by the given keyword(s).

Parameters:

q – Keyword(s) to search for (separated by spaces).

Returns:

List of group data fields. Example: [{“id”: “result_acq”, “text”: “ACQ Score”, “aggregates”: [“count”, “avg”, “sum”, “max”, “min”, “var_pop”, “var_samp”, “variance”, “stddev_pop”, “stddev_samp”, “stddev”], “selected”: false, “aggregate”: null}]

class ResourceTableStateGroupField(request, context=None)
delete()

/api/v1/table/state/group/field

Delete the active group fields.

Returns:

[]

get()

/api/v1/table/state/group/field

Get list of group fields. Optionally, the list is filtered by the given keyword(s).

Parameters:

q – Keyword(s) to search for (separated by spaces).

Returns:

List of group fields. Example: [{“id”: “result_acq”, “text”: “ACQ Score”, “selected”: false}, {“id”: “result_acq_timestamp”, “text”: “ACQ Score, last measurement”, “selected”: false}]

class ResourceTableStateGroupToggleData(request, context=None)
put()

/api/v1/table/state/group/toggle/data/{column_id}

Toggle a data field (switch between active and inactive).

Parameters:

column_id – Identifier of the column.

Returns:

True

class ResourceTableStateGroupToggleField(request, context=None)
put()

/api/v1/table/state/group/toggle/field/{column_id}

Toggle a group field (switch between active and inactive).

Parameters:

column_id – Identifier of the column.

Returns:

True

class ResourceTableStateGroupfraction(request, context=None)
collection_get()

/api/v1/table/state/groupfraction

Get list of active (i.e. selected) group fractions.

Returns:

List of all active group fractions. Example: [{“id”: “acq_score”, “text”: “ACQ Score”, “description”: “ACQ Score”, “selected”: [{“id”: 4, “text”: “1”}], “userexpr”: true}]

put()

/api/v1/table/state/groupfraction/{filter_id}

Set a number of valid values for a particular group fraction.

Parameters:
  • filter_id – Identifier of the filter.

  • values – List of filter values. Example: [“5”, “7”]

Returns:

True

class ResourceTableStateGroupfractionsInactive(request, context=None)
collection_get()

/api/v1/table/state/groupfractions/inactive

Get list of all inactive group fractions. Optionally, the list is sorted by how well its items match given keyword(s).

Parameters:

q – Keyword(s) to search for (separated by spaces).

Returns:

List of group fractions. Example: [{“id”: “acq_score”, “text”: “ACQ Score”, “description”: “ACQ Score”, “selected”: [{“id”: 4, “text”: “1”}], “userexpr”: true}]

class ResourceTableStatePage(request, context=None)
put()

/api/v1/table/state/page/{page_id}

Move to specified page in table.

Returns:

True

class ResourceTableStatePivotAggregate(request, context=None)
put()

/api/v1/table/state/pivot/aggregate/{column_id}/{index}

Set pivot aggregate.

Parameters:
  • column_id – Identifier of the column.

  • index – Index of the aggregate.

Returns:

True

class ResourceTableStatePivotColumn(request, context=None)
delete()

/api/v1/table/state/pivot/column

Delete the active pivot columns.

Returns:

[]

get()

/api/v1/table/state/pivot/column

Get all pivot columns. Optionally, the list is sorted by how well its items match given keyword(s).

Parameters:

q – Keyword(s) to search for (separated by spaces).

Returns:

List of pivot columns. Example: [{“id”: “result_acq”, “text”: “ACQ Score”, “selected”: true}, {“id”: “result_acq_timestamp”, “text”: “ACQ Score, last measurement”, “selected”: false}]

class ResourceTableStatePivotData(request, context=None)
delete()

/api/v1/table/state/pivot/data

Delete the active pivot data.

Returns:

[]

get()

/api/v1/table/state/pivot/data

Get list of pivot data. Optionally, the list is filtered by the given keyword(s).

Parameters:

q – Keyword(s) to search for (separated by spaces).

Returns:

List of pivot data. Example: [{“id”: “number_examinations”, “text”: “Number of examinations”, “aggregates”: [“count”, “avg”], “selected”: false, “aggregate”: null}]

class ResourceTableStatePivotRow(request, context=None)
delete()

/api/v1/table/state/pivot/row

Delete all pivot rows.

Returns:

[]

get()

/api/v1/table/state/pivot/row

Get list of pivot rows. Optionally, the list is filtered by the given keyword(s).

Parameters:

q – Keyword(s) to search for (separated by spaces).

Returns:

List of pivot rows. Example: [{“id”: “result_acq”, “text”: “ACQ Score”, “selected”: false}, {“id”: “result_acq_timestamp”, “text”: “ACQ Score, last measurement”, “selected”: false}]

class ResourceTableStatePivotToggleColumn(request, context=None)
put()

/api/v1/table/state/pivot/toggle/column/{column_id}

Toggle pivot column (between active and inactive).

Parameters:

column_id – Identifier of the column.

Returns:

True

class ResourceTableStatePivotToggleData(request, context=None)
put()

/api/v1/table/state/pivot/toggle/data/{column_id}

Toggle pivot data (between active and inactive).

Parameters:

column_id – Identifier of the column.

Returns:

True

class ResourceTableStatePivotToggleRow(request, context=None)
put()

/api/v1/table/state/pivot/toggle/row/{column_id}

Toggle pivot row (between active and inactive).

Parameters:

column_id – Identifier of the column.

Returns:

True

class ResourceTableStateReset(request, context=None)
post()

/api/v1/table/state/reset/{table_type}

Switch table to specified type (flat, group, pivot) and reset contents.

Returns:

None

class TableState(request, context=None)

Helper class for REST table actions

get_table()

Get active table from cache or re-calculation

reset()

Reset the cached table

save()

Save table

8.2. Presets

The Presets API provides a number of REST calls that operate on presets (pre-configured tables).

class ResourcePresets(request, context=None)
collection_get()

/api/v1/presets

Get list of presets.

Returns:

List of presets. Dictionary containing “presets”, “categories” and “roots”.

collection_post()

/api/v1/presets

Create new preset.

Parameters:
  • name – Preset name

  • description – Preset description

  • category – Preset category

  • visibility – Preset visibility

Returns:

Created preset

delete()

/api/v1/presets/{preset_id}

Delete preset with specified identifier.

Parameters:

preset_id – Identifier of the preset.

Returns:

{}

put()

/api/v1/presets/{preset_id}

Update preset with specified identifier.

Parameters:
  • preset_id – Identifier of the preset.

  • name – Preset name

  • description – Preset description

  • category – Preset category

  • visibility – Preset visibility

Returns:

Updated preset

class ResourcePresetsBreadcrumbs(request, context=None)
get()

/api/v1/presets/breadcrumbs

Get breadcrumbs for active preset. Returns a list containing a breadcrumb list (each breadcrumb having a number and a name), the name of the preset, and a flag signaling if the preset has been modified by the user.

Returns:

Breadcrumbs for active preset. Example: [[[3, “Public presets”], [10, “CGM”]], “Overview”, false]

class ResourcePresetsCategory(request, context=None)
collection_post()

/api/v1/presets/category

Create new preset category.

Parameters:
  • name – Preset category name

  • parent – Identifier of the parent category

Returns:

Created preset category. Example: {“id”: 25, “name”: “New category”, “description”: null, “schema_id”: 1, “user_id”: 2, “group_id”: null, “parent”: 1, “public”: false, “readonly”: false, “predefined”: false}

delete()

/api/v1/presets/category/{category_id}

Delete preset category with specified identifier.

Parameters:

preset_id – Identifier of the preset category.

Returns:

{}

put()

/api/v1/presets/category/{category_id}

Update preset category with specified identifier.

Parameters:
  • preset_id – Identifier of the preset category.

  • name – Preset category name

  • parent – Identifier of the parent category

Returns:

Created preset category. Example: {“id”: 25, “name”: “Renamed category”, “description”: null, “schema_id”: 1, “user_id”: 2, “group_id”: null, “parent”: 1, “public”: false, “readonly”: false, “predefined”: false}

class ResourcePresetsSearch(request, context=None)
get()

/api/v1/presets/search

Search for presets based on specified keyword(s).

Parameters:

q – Keyword(s) to search for (separated by spaces).

Returns:

List of presets. Example: [{“id”: 4, “name”: “All patients”, “path”: “Public presets, Patientlists”, “description”: “All patients”, “public”: true}]