Visualizing medical code hierarchy with treemaps
2 days ago
- The post uses Python's squarify library to create treemaps visualizing the count of HCPCS and ICD-10 codes starting with each letter, where square size is proportional to code count, not usage frequency.
- Letters with very few codes (R and U for HCPCS, U for ICD-10) are omitted from the treemaps due to their small size.
- The provided code (shown for HCPCS) uses matplotlib and squarify, with a dictionary of code counts per letter, colors, and labels; the ICD-10 map differs only in data.
- The post highlights that good medical nomenclature avoids encoding parent-child relationships in identifiers, contrasting SNOMED's multiple-parent hierarchy (more useful for research) with ICD/CPT, which are harder to visualize in a simple treemap.