Forked from Python-samples
Client for working with data from the WHO ICD REST API
- get a client id and secret from ICD API Access Keys
- make an instance of Api:
from icd_api import Api
# create an instance directly (change `your_client_id` and `your_client_secret`):
api = Api(base_url="https://id.who.int/icd",
language="en",
api_version="v2",
linearization_name="mms",
release_id="2024-01",
token_endpoint="https://icdaccessmanagement.who.int/connect/token",
client_id=your_client_id,
client_secret=your_client_secret,
cached_session_config={})
# alternatively, create an instance using environment variables
# add `your_client_id` and `your_client_secret` to a `.env` file
# (see env.sample for a complete reference)
api = Api.from_environment()
- use the api class to make requests:
- get a foundation entity:
api.get_entity(entity_id="455013390")
- lookup an entity in the linearization:
api.lookup(entity_id="1944385475")
- search for entities:
api.search_entities(search_string="condition")
- ICD API Local Deployment
- Local deployments do not have authentication, so
client_id
,client_secret
, andtoken_endpoint
are not required