Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/spiros/phemap
Functions to map between ICD-10 terms and PheCodes for UK Biobank hospital electronic health records
https://github.com/spiros/phemap
clinical-terminologies electronic-health-records icd-10 phecode uk-biobank
Last synced: 2 days ago
JSON representation
Functions to map between ICD-10 terms and PheCodes for UK Biobank hospital electronic health records
- Host: GitHub
- URL: https://github.com/spiros/phemap
- Owner: spiros
- License: apache-2.0
- Created: 2019-07-01T12:57:23.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-27T16:40:01.000Z (almost 2 years ago)
- Last Synced: 2024-08-02T16:44:40.044Z (3 months ago)
- Topics: clinical-terminologies, electronic-health-records, icd-10, phecode, uk-biobank
- Language: Python
- Homepage:
- Size: 132 KB
- Stars: 28
- Watchers: 1
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-uk-biobank - phemap - 10 terms and PheCodes for UK Biobank hospital electronic health records | (Derivation of variables / Electronic health records)
README
Phemap [![Build Status](https://travis-ci.org/spiros/phemap.svg?branch=master)](https://travis-ci.org/spiros/phemap)
--------------This utility provides some very basic functions
to map between ICD-10 terms used in hospital diagnoses
for UK Biobank and PheCodes as outlined
in Wu P. et al. https://www.biorxiv.org/content/10.1101/462077v5Requires the phecode definitions file and the icd10-to-phecode
mapping file - you can grab the latest version of both
files from https://phewascatalog.org/phecodesNotes
-----UK Biobank secondary care data are coded using ICD-10 but the dot
has been stripped out i.e. "I21.0 Ischaemic heart disease" is recorded
as 'I210' so you will need to add the dot separator prior to attempting
to match.Not all ICD-10 terms are mapped to PheCodes and not all PheCodes
which are mapped to ICD-10 terms appear to have a valid definition
in the PheCodes definition file. Mappings are usually one-to-one but can also
be one-to-many:
> Of all possible ICD-10 codes, 9,165 (76.20%) mapped to at least one PheCode, and 289 (2.40%) mapped to >1 PheCode. ICD-10 code B21.1 (HIV disease resulting in Burkitt’s lymphoma) maps to two PheCodes: 071.1 (HIV infection, symptomatic) and 202.2 (Non-Hodgkin's lymphoma).Examples
--------```
from phemap import Phemapsource_file = 'data/phecode_definitions1.2.csv'
mapping_file = 'data/phecode_map_v1_2_icd10_beta.csv'phemap = Phemap(source_file=source_file, mapping_file=mapping_file)
>>> phemap.get_icd_for_phecode('495')
['J45.8', 'J45', 'J45.1', 'J45.0', 'J45.9']>>> phemap.get_phecode_for_icd10('J45.1')
'495'>>> phemap.get_phecode_info('495')
{'phecode': '495',
'phenotype': 'Asthma',
'phecode_exclude_range': '490-498.99',
'sex': nan,
'rollup': '1',
'leaf': '0',
'category_number': '9',
'category': 'respiratory',
'phecode_num': 495.0}>>> phemap.get_phecode_exclusions('495')
['495',
'495.1',
'495.11',
'495.2',
'496',
'496.1',
'496.2',
'496.21',
'496.3',
'497',
'498']>>> all_phecodes = phemap.get_all_phecodes()
>>> all_phecodes[10]
{'phecode': '038.1',
'phenotype': 'Gram negative septicemia',
'phecode_exclude_range': '010-041.99',
'sex': 'Both',
'rollup': '1',
'leaf': '1',
'category_number': '1',
'category': 'infectious diseases',
'phecode_num': 38.1}
```Useful reading material
-----------------------https://www.biorxiv.org/content/10.1101/462077v4
https://www.ncbi.nlm.nih.gov/pubmed/20335276
https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0175508