This repo contains a simple script for downloading HCUP clinical code maps for diagnoses (ICD9) and CPTEVENTS.
In longitudinal EHR data clinical codes assigned to patients generally fall under a broader category and as there are limited data for each set of codes it may be useful to decrease the sparsity by grouping the codes under their common ancestor.
Here we use two tools provided by HCUP-US to achieve this:
- CCS/AppendixASingleDx.txt
- 2019_ccs_services_procedures
Refer to here for a description of the above.
python hcups_utils.py -t CPT --save_path ./data
python hcups_utils.py -t ICD9 --save_pah ./data
There are different ways of mapping Procedure codes, for example using crosswalk.
In MappingProcToCCS.ipynb
I've outlined how to do this using an external tool as well.
You can find sample outputs (i.e. codes to id's map) in example_output/