Creating an ICD-10 WHO Value Set from WHO’s ClaML Files

For those looking to build master data of ICD-10, if you aren’t required to use the international WHO version, the easiest way (maybe in Thailand) is to use ICD-10-TM (the Thai Modification). You can download it directly from the THCC website.

However, ICD-10-TM includes additional codes specific to Thailand. If you have a strict requirement to use the official WHO version only, the most accessible source is the WHO website’s download page.

WHO publishes the data in two formats:

  1. Tabular: A list of all codes, but it lacks the codes that require additional combination (this is call post-coordination/subdivision).
  2. Classification Markup Language (ClaML): This contains all the data shown in the ICD-10 browser. I find this much more suitable for creating a truly comprehensive value set.

I recently had the opportunity to work on this, so I’m documenting the process here. I should note that I am not an expert; if there are any errors or better methods, please feel free to suggest them.

The process consists of 4 main steps:

1. Extracting from ClaML

If you open the ICD-10 browser alongside the ClaML file, it’s quite easy to understand. You can even use AI to help extract specific elements.

The key point to notice is the <ModifiedBy> element within a Class. For example, the code M60 (Myositis) points to the modifier S13M00_5.

ICD-10 M60 has ModifiedBy element with the code S13M00_5

You can look further up the file for that modifier code

Modifier code S13M00_5

And below that are the details of what each subclass (digit) represents.

By comparing this to the browser, you can see the connection

AI is generally very good at understanding where to pull these components to form a complete description.

Tip: When extracting descriptions, prioritize kind = preferredLong. If that’s unavailable, use the standard preferred.

2. Defining Additional Composition Rules

However, the rules for which codes can be combined aren’t always fully structured in the XML. You need to manually implement a few rules, especially for Chapter XX: External causes (V to Y):

  • Place of Occurrence codes apply only to W00–Y34.
  • Activity codes apply only to V01–Y34.
  • Place should be placed before Activity.
  • If a code already has 4 digits (3 characters + 1 decimal), you cannot add a Place code; you can only add an Activity code.

Example 1: Both Place and Activity can be added

  • X87 (Assault by pesticides)
  • X87.0 (+ “at home” — note: you must manually add the word “at”)
  • X87.00 (+ “while engaged in sports activity”)
  • Full description: X87.00 Assault by pesticides: at home: while engaged in sports activity

Example 2: Only Activity can be added

  • X88.1 (Assault by carbon monoxide from utility gas)
  • Since the .1 is already occupied, you cannot add a Place code.
  • X88.10 (+ “while engaged in sports activity”)
  • Full description: X88.10 Assault by carbon monoxide from utility gas: while engaged in sports activity

3. Term Management

The phrasing style is up to your preference. For instance, ICD-10-TM doesn’t use colons (“:”) but concatenates the words directly, e.g., “Assault by pesticides at home While engaged in sports activity”.

However, there are two specific groups I found that require special handling for readability:

  • Group Y40–Y59: You should append “causing adverse effects in therapeutic use” to the end. For example, Y40.0 is just “Penicillins”. To make it clear, it should be “Penicillins causing adverse effects in therapeutic use”.
  • Group Y60–Y69: You should prepend the main class description. For example, Y60.0 (“During surgical operation”) becomes “Unintentional cut, puncture, perforation or haemorrhage during surgical and medical care: during surgical operation”.

4. Pruning Impossible Code Combinations

When you assemble codes in steps 1 and 2, you will inevitably generate “impossible” codes. For example, M76.1 (Psoas tendinitis) shouldn’t be combined with the modifier for “Shoulder region”. These anatomical mismatches (mostly in chapters M, S, and V) must be removed.

I couldn’t find a ready-made algorithm for this, so my approach was to cross-reference with existing systems. My goal was to make this compatible with SNOMED CT mappings and OMOP, so codes existing in either of those should be kept.

I used the following logic in my spreadsheet:

  • IsGenerated: Is it a newly assembled code?
  • In10TM: Does ICD-10-TM contain it?
  • InOMOP: Does OMOP contain it?
  • InSCT: Is it mapped from SNOMED?
  • IsTerminal: Is it a leaf node? (Terminal nodes are for coding; non-terminals are headings). This info is from the source file.
Excel file that was generated from ClaML file

I focused specifically on rows where isGenerated was TRUE (representing the codes we newly assembled). From there, I cross-referenced them with 10TM (You can adapt to the version in your country), OMOP, and SCT. If any one of these was TRUE, I might kept the row. If all three were FALSE, they were candidates for deletion. I still performed a final review before actually hitting delete.

After that, I did some manual filtering. For example, I looked for codes that were absent in 10TM and SCT but were somehow still kept in OMOP. I found about 20 of these “weird” codes and decided to delete them as well.

On the other hand, for codes that weren’t in 10TM or OMOP but were present in SCT, the numbers were very low. I chose to keep these because they seemed medically plausible.

The final result is a value set of approximately 38,000 codes. Interestingly, this process also helps identify which codes are unique to ICD-10-TM. If you take all the codes generated before Step 4 and subtract the ICD-10-TM list, the remainder are the specific additions made for the Thai version.


Rath Panyowat Avatar

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

©2025 Rath Panyowat. All rights reserved.