ICD-9 XML,CSV或数据库格式的代码列表 [英] ICD-9 Code List in XML, CSV, or Database format
问题描述
我正在寻找一种可导入数据库并以程序方式引用的格式的疾病和程序ICD-9代码(医疗规则)的完整列表。我的问题基本上与寻找ICD-9代码的资源,但原来的海报忽略了提到他在哪里预见他的完整列表。
I am looking for a complete list of ICD-9 Codes (Medical Codes) for Diseases and Procedures in a format that can be imported into a database and referenced programmatically. My question is basically exactly the same as Looking for resources for ICD-9 codes, but the original poster neglected to mention where exactly he "got ahold of" his complete list.
Google绝对不是我的朋友,因为我花了很多时间查看问题,发现了许多富文本类型列表(如CDC)或网站下钻到完整的列表交互式,但我不能找到在哪里得到填充这些网站的列表,可以解析到数据库。我相信这里的文件 ftp://ftp.cdc.gov / pub / Health_Statistics / NCHS / Publications / ICD9-CM / 2009 / 有我正在寻找,但文件是富文本格式,并包含很多垃圾和格式化,将难以准确删除。
Google is definitely not my friend here as I have spent many hours googling the problem and have found many rich text type lists (such as the CDC) or websites where I can drill down to the complete list interactively, but I cannot find where to get the list that would populate these websites and can be parsed into a Database. I believe the files here ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/Publications/ICD9-CM/2009/ have what I am looking for but the files are rich text format and contain a lot of garbage and formatting that would be difficult to remove accurately.
我知道这是其他人所做的,我试图避免重复其他人的努力,但我只是找不到xml / CSV / Excel列表。 p>
I know this has to have been done by others and I am trying to avoid duplicating other peoples effort but I just cannot find an xml/CSV/Excel list.
推荐答案
删除RTF后,解析文件并将其转换为CSV并不难。我的结果解析文件包含所有2009年ICD-9疾病和程序代码: http:// www .jacotay.com / files / Disease_and_ProcedureCodes_Parsed.zip
我写的解析器在这里: http://www.jacotay.com/files/RTFApp.zip
基本上这是一个两个步骤的过程 - 从CDC FTP站点获取文件,并从中删除RTF,然后选择无RTF文件,并将其解析为CSV文件。
这里的代码很粗糙,因为我只需要得到一次结果。
After removing the RTF it wasn't too hard to parse the file and turn it into a CSV. My resulting parsed files containing all 2009 ICD-9 codes for Diseases and Procedures are here: http://www.jacotay.com/files/Disease_and_ProcedureCodes_Parsed.zip My parser that I wrote is here: http://www.jacotay.com/files/RTFApp.zip Basically it is a two step process - take the files from the CDC FTP site, and remove the RTF from them, then select the RTF-free files and parse them into the CSV files. The code here is pretty rough because I only needed to get the results out once.
这里是解析应用程序的代码,以防外部链接
Here is the code for the parsing app in case the external links go down (back end to a form that lets you select a filename and click the buttons to make it go)
Public Class Form1
Private Sub btnBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowse.Click
Dim p As New OpenFileDialog With {.CheckFileExists = True, .Multiselect = False}
Dim pResult = p.ShowDialog()
If pResult = Windows.Forms.DialogResult.Cancel OrElse pResult = Windows.Forms.DialogResult.Abort Then
Exit Sub
End If
txtFileName.Text = p.FileName
End Sub
Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
Dim pFile = New IO.FileInfo(txtFileName.Text)
Dim FileText = IO.File.ReadAllText(pFile.FullName)
FileText = RemoveRTF(FileText)
IO.File.WriteAllText(Replace(pFile.FullName, pFile.Extension, "_fixed" & pFile.Extension), FileText)
End Sub
Function RemoveRTF(ByVal rtfText As String)
Dim rtBox As System.Windows.Forms.RichTextBox = New System.Windows.Forms.RichTextBox
'// Get the contents of the RTF file. Note that when it is
'// stored in the string, it is encoded as UTF-16.
rtBox.Rtf = rtfText
Dim plainText = rtBox.Text
Return plainText
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim pFile = New IO.FileInfo(txtFileName.Text)
Dim FileText = IO.File.ReadAllText(pFile.FullName)
Dim DestFileLine As String = ""
Dim DestFileText As New System.Text.StringBuilder
'Need to parse at lines with numbers, lines with all caps are thrown away until next number
FileText = Strings.Replace(FileText, vbCr, "")
Dim pFileLines = FileText.Split(vbLf)
Dim CurCode As String = ""
For Each pLine In pFileLines
If pLine.Length = 0 Then
Continue For
End If
pLine = pLine.Replace(ChrW(9), " ")
pLine = pLine.Trim
Dim NonCodeLine As Boolean = False
If IsNumeric(pLine.Substring(0, 1)) OrElse (pLine.Length > 3 AndAlso (pLine.Substring(0, 1) = "E" OrElse pLine.Substring(0, 1) = "V") AndAlso IsNumeric(pLine.Substring(1, 1))) Then
Dim SpacePos As Int32
SpacePos = InStr(pLine, " ")
Dim NewCode As String
NewCode = ""
If SpacePos >= 3 Then
NewCode = Strings.Left(pLine, SpacePos - 1)
End If
If SpacePos < 3 OrElse Strings.Mid(pLine, SpacePos - 1, 1) = "." OrElse InStr(NewCode, "-") > 0 Then
NonCodeLine = True
Else
If CurCode <> "" Then
DestFileLine = Strings.Replace(DestFileLine, ",", ",")
DestFileLine = Strings.Replace(DestFileLine, """", """).Trim
DestFileText.AppendLine(CurCode & ",""" & DestFileLine & """")
CurCode = ""
DestFileLine = ""
End If
CurCode = NewCode
DestFileLine = Strings.Mid(pLine, SpacePos + 1)
End If
Else
NonCodeLine = True
End If
If NonCodeLine = True AndAlso CurCode <> "" Then 'If we are not on a code keep going, otherwise check it
Dim pReg As New System.Text.RegularExpressions.Regex("[a-z]")
Dim pRegCaps As New System.Text.RegularExpressions.Regex("[A-Z]")
If pReg.IsMatch(pLine) OrElse pLine.Length <= 5 OrElse pRegCaps.IsMatch(pLine) = False OrElse (Strings.Left(pLine, 3) = "NOS" OrElse Strings.Left(pLine, 2) = "IQ") Then
DestFileLine &= " " & pLine
Else 'Is all caps word
DestFileLine = Strings.Replace(DestFileLine, ",", ",")
DestFileLine = Strings.Replace(DestFileLine, """", """).Trim
DestFileText.AppendLine(CurCode & ",""" & DestFileLine & """")
CurCode = ""
DestFileLine = ""
End If
End If
Next
If CurCode <> "" Then
DestFileLine = Strings.Replace(DestFileLine, ",", ",")
DestFileLine = Strings.Replace(DestFileLine, """", """).Trim
DestFileText.AppendLine(CurCode & ",""" & DestFileLine & """")
CurCode = ""
DestFileLine = ""
End If
IO.File.WriteAllText(Replace(pFile.FullName, pFile.Extension, "_parsed" & pFile.Extension), DestFileText.ToString)
End Sub
结束类
这篇关于ICD-9 XML,CSV或数据库格式的代码列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!