Reputation: 141
I have an XML file but i think it is not processable. What should I do to create database for ICD-10 disease codes.
Upvotes: 2
Views: 5986
Reputation: 19456
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
ICD-10 Data source: ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/Publications/ICD10CM/2020
Upvotes: 0
Reputation: 1204
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/
Upvotes: 4