2

I have an XML file but i think it is not processable. What should I do to create database for ICD-10 disease codes.

Khalid Zubair
  • 141
  • 2
  • 9
  • Welcome to StackOverflow. This question is unclear/too broad as written. What __specific__ technical challenge are you facing, and what concrete steps have you taken to overcome it? Where are you getting hung up? – Dan Field Dec 30 '15 at 13:25
  • [How do I ask a **good** question?](http://stackoverflow.com/help/how-to-ask) – marc_s Dec 30 '15 at 13:28
  • Thank you for your quick response. Actually I want to create a database for ICD Codes in sql server. XML files are there but i don't know weather xml files are usable for sql database creation or how . – Khalid Zubair Dec 30 '15 at 13:28
  • Thank you @marc_s. Appreciated. :) – Khalid Zubair Dec 30 '15 at 13:34
  • Your current questions is too open-ended, too broad - you need to give us more concrete, detailed information - what are you trying to do? What is the point where you run into problems? As it stands, it's just too broad - entire books have been written on the topic - can't *answer* this in a few paragraphs and a few code lines – marc_s Dec 30 '15 at 13:36
  • @DanField , waiting for your kind response? – Khalid Zubair Dec 30 '15 at 13:36
  • ICD-10 Codes are World Health Organization's Codes for identifying diseases. I want to create a database for ICD-10 Codes. But it has approx 68000 codes. How to create sql database easily for ICD-10 Codes ? – Khalid Zubair Dec 30 '15 at 13:39
  • @KhalidZubair, even if your question is "How do I create a database schema from an XML file", that's still too broad/open ended. A good part of my consulting work revolves around answering that question ;) – Dan Field Dec 30 '15 at 13:39
  • How to send a rar file in stack overflow ? I'll send you that xml file. Have a look . @DanField :) – Khalid Zubair Dec 30 '15 at 13:42
  • Intestinal infectious diseases Tuberculosis This is a part of code . @DanField – Khalid Zubair Dec 30 '15 at 13:44
  • @KhalidZubair, my last comment was meant to indicate that this is a question I would expect to get paid to answer, as it stands right now. Check up on marc_s's link if you want to come up with a StackOverflow appropriate question. If you're looking for professional services, contact me via my email in my profile. – Dan Field Dec 30 '15 at 13:46
  • Okay. Thank you. :) @DanField – Khalid Zubair Dec 30 '15 at 17:47

2 Answers2

4

Khalid!

I'm also was looking for an answer to a similar question. So I've found answer like this - ICD10 MYSQL TABLES

So you have to choose not ICD-10 (2016) XML file but ICD-10 2010 version with Plain text tabular.

Next I've imported this text file in my dbForge Studio for MySQL. And it all works!

Steps for import ICD-10 by SQL you could find in the source post http://fash7y.wordpress.com/2012/04/05/import-icd-10-to-mysql-database/

Community
  • 1
  • 1
franchb
  • 1,174
  • 4
  • 19
  • 42
0

Using python to create a csv file could help. E.g.

from __future__ import print_function
import xml.etree.cElementTree as ET
import csv
import sys
import os

tree = ET.parse(sys.argv[1])
root = tree.getroot() 

fieldnames = ['code', 'description']
spamwriter = csv.writer(sys.stdout, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)

spamwriter.writerow(fieldnames)
for code in root.findall(".//diag"):
    spamwriter.writerow([code.find("./name").text.encode('utf-8').strip(), code.find("./desc").text.encode('utf-8').strip()])

The end result

code,description
A00,Cholera
A00.0,"Cholera due to Vibrio cholerae 01, biovar cholerae"
A00.1,"Cholera due to Vibrio cholerae 01, biovar eltor"
A00.9,"Cholera, unspecified"
A01,Typhoid and paratyphoid fevers
...

Usage

python icd102csv.py ICD10CM_2020_Full_Tabular.xml > icd10-codes-2020.csv

Then import into MySQL

ICD-10 Data source: ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/Publications/ICD10CM/2020

Alex Nolasco
  • 18,750
  • 9
  • 86
  • 81