This repository contains Python code that allows you to retrieve and display the medical code names for ICD-10, SNOMED CT, and UMLS coding systems in various languages. This code can be used as an example for how to use the ICD, SNOMED and UMLS APIs in Python.
Coding systems like ICD, SNOMED, and UMLS are excellent tools for standardizing medical nomenclature and ensuring consistency in medical documentation across various languages. However, medical records typically only store code display names in a single language, and, given that we are a centre located in Québec, Canada, display names often need to be translated between and displayed in both French and English. Therefore, this tool was created to facilitate the retrieval of medical code display names in any language using the coding systems' APIs.
code_api_requests.py
: Contains functions to retrieve display names for medical codes from ICD-10, SNOMED CT, and UMLS APIs.Authentication.py
: Handles UMLS API authentication using an API key.config.py
: Contains configuration variables for accessing the ICD-10 and UMLS APIs.requirements.txt
: The required python packages.Example.py
: Demonstrates how to use the functions incode_api_requests.py
.
- Python >= 3.8
- lxml >= 5.3.0
- requests >= 2.32.2
- ICD: Register at https://icd.who.int/icdapi (see "API ACCESS") to get an access token.
- UMLS: Register at https://documentation.uts.nlm.nih.gov/rest/home.html (click "Get Your API Key") to get an API key.
- Clone the repository:
git clone https://github.com/kildealab/codingSystemAPIs.git
- Install dependenices:
cd codingSystemAPIs pip install -r requirements.txt
-
Set up configuration: Update the
config.py
file with your API credentials. Specifically, you will need to change:- For ICD:
client_id
andclient_secret
- For UMLS:
umls_api_key
- Coding system versions (optional):
icd_version
,umls_version
,snomed_version
. Seeconfig.py
for more info.
- For ICD:
-
Retrieve coding names: Import
code_api_requests
and use the following function calls in your code to retrieve the display name in any language from the code. An example usage is shown inExample.py
.# Example python code from code_api_requests import get_icd10_display, get_snomed_display, get_umls_display get_icd_display(code="C77.0", lang='fr')) # ICD Example get_snomed_display(code="774007", lang='fr')) # SNOMED-CT Example get_umls_display(code="C0155502", lang='FRE')) # UMLS Example
-
Running the example: If you want to verify that your configuration variables have been set up properly, you can directly run
Example.py
. Note that if you want to use ICD-11 instead of ICD-10, you will have to uncomment the final example and change the version inconfig.py
.python Example.py
We welcome contributions! If you are interested in contributing, please fork the repository and create a pull request with your changes.
- Fork the repository.
- Create a new branch:
git checkout -b feature-name
- Make your changes and commit them.
- Push your branch:
git push origin feature-name
- Create a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
For support or questions, please email Kayla O'Sullivan-Steben at kayla.osullivan-steben@mail.mcgill.ca.