Skip to content

Ontology

Ontology

Bases: Endpoint

Queries ontology/ endpoints

Functions

get(**kwargs)

Queries ontology/node/, with optional query parameters

NOTE
  • See the following URL for more information on query parameters: https://conceptlibrary.saildatabank.com/api/v1/#operations-tag-ontology

  • Adding the ?exact_codes will match the exact SNOMED code instead of fuzzy matching the given codes across all related mappings (ICD-9/10, MeSH, OPSC4, ReadCodes etc)

Keyword Args:

Param Type Default Desc
search string NULL Full-text search
codes list NULL Either (a) SNOMED code (see below); or (b) Code ID
exact_codes empty NULL apply this parameter if you would like to search for exact codes
type_ids list NULL Filter ontology type by ID
reference_ids list NULL Filter ontology by Atlas reference
page number 1 Page cursor
page_size enum 1 (20 results) Page size enum, where: 1 = 20, 2 = 50 & 3 = 100 rows

Returns:

Name Type Description
Response dict | list
  • If paginated: a dict of ontological nodes matching query parameters
  • If unpaginated: a list of ontological nodes matching query parameters

Examples:

>>> from pyconceptlibraryclient import Client
>>> client = Client(public=False)
>>> # Get all ontological term(s) (nodes; defaults to paginated)
>>> client.ontology.get()
>>> # Search ontological terms (apply '?exact_codes' parameter to search only SNOMED codes)
>>> client.ontology.get(search='dementia', codes='281004,569.82')

get_detail(id)

Queries ontology/node/{id}/

Parameters:

Name Type Description Default
id int

Ontology node ID

required

Returns:

Name Type Description
Response dict

Details of queried ontology

Examples:

>>> import pyconceptlibraryclient
>>> client = Client(public=False)
>>> client.ontology.get_detail(1)

get_group_detail(id)

Queries ontology/type/{id}/; gets an ontology group's detail

Parameters:

Name Type Description Default
id int

Ontological ID

required

Returns:

Name Type Description
Response dict

Details of the queried ontology group

Examples:

>>> import pyconceptlibraryclient
>>> client = Client(public=False)
>>> client.ontology.get_group_detail(1)

get_groups()

Queries ontology/; gets list of all ontological groups (types)

Returns:

Name Type Description
Response list

Details of the ontology groups

Examples:

>>> import pyconceptlibraryclient
>>> client = Client(public=False)
>>> client.ontology.get_detail(1)