mappavoo wrote on Wednesday, September 15, 2010:
In Countries like South Africa we need use** ICD-10 Code**s instead of ICD-9 coes
mappavoo wrote on Wednesday, September 15, 2010:
In Countries like South Africa we need use** ICD-10 Code**s instead of ICD-9 coes
sunsetsystems wrote on Wednesday, September 15, 2010:
ICD10 could be implemented very similarly to ICD9. There’s a utility in the distribution at contrib/util/load_icd_desc.plx that scrapes ICD9 codes from http://www.icd9data.com/, and it could surely be adapted to do the same with http://www.icd10data.com/. Just some programming effort.
mappavoo wrote on Wednesday, September 15, 2010:
Thank you ROD I will make the necessary program changes for ICD10 and reload it.
johnbwilliams wrote on Wednesday, September 15, 2010:
-The HHS HIT Standards Committee Vocabulary Task Force, the HIT Standards Implementation Workgroup, and the ONC Standards and Interoperability Framework contractors are working on a national repository of vocabularies and codesets to support EHR needs. OpenEMR might leverage this repository when it becomes available.
mappavoo wrote on Wednesday, September 15, 2010:
Hi Rod,
I have tried the following code
my $START_URL = “http://www.icd10data.com”;
or
my $START_URL = “http://www.icd10data.com/”;
error getting http://www.icd10data.com/ICD10CM/codes//ICD10CM/codes not found at line 81
Herewith is my code
/***********************************STart of code*************************************************************************************/
#my $START_URL = “http://www.icd9data.com/2009/Volume1/default.htm”;
my $START_URL = “http://www.icd10data.com”;
#my $START_URL = “http://www.icd10data.com/”;
# An empty database name will cause SQL INSERT statements to be dumped
# to stdout, with no database access. To update your OpenEMR database
# directly, specify its name here.
#
my $DBNAME = “openemr”;
# You can hard-code the database user name and password (see below),
# or else put them into the environment with bash commands like these
# before running this script:
#
# export DBI_USER=username
# export DBI_PASS=password
#
#my $dbh = DBI->connect(“dbi:mysql:dbname=$DBNAME”) or die $DBI::errstr
# if ($DBNAME);
my $dbh = DBI->connect(“dbi:mysql:dbname=$DBNAME”, “openemr”, “0p3n3mr”)
or die $DBI::errstr if ($DBNAME);
# Comment this out if you want to keep old nonmatching codes.
#
$dbh->do(“delete from codes where code_type = 2”) or die “oops”
if ($DBNAME);
#######################################################################
# Startup #
#######################################################################
$| = 1; # Turn on autoflushing of stdout.
my $countup = 0;
my $countnew = 0;
#######################################################################
# Main Logic #
#######################################################################
# This function recursively scrapes all of the web pages.
#
sub scrape {
my $url = shift;
my $browser = WWW::Mechanize->new();
MONTY WROTE HERE IS LINE 81 -> $browser->get($url);
my $parser = HTML::TokeParser->new($browser->content());
while(my $tag = $parser->get_tag(“li”, “div”)) {
# The <li><a> sequence is recognized as a link to another list
# that must be followed. We handle those recursively.
if ($tag-> eq “li”) {
$tag = $parser->get_tag;
next unless ($tag-> eq “a”);
my $nexturl = $browser->base();
# $nexturl =~ s’/+$’/’;
$nexturl =~ s’/20.+$’’;
scrape($nexturl . $tag->{href});
}
# The <div><img> sequence starts an ICD10 code and description.
# If the “specific green” image is used then we know this code is
# valid as a specific diagnosis, and we will grab it.
else {
$tag = $parser->get_tag;
next unless ($tag-> eq “img”);
next unless ($tag->{src} =~ /SpecificGreen/);
$tag = $parser->get_tag(“a”);
my $tmp = $parser->get_trimmed_text;
unless ($tmp =~ /Diagnosis Code (\S+)/) {
print STDERR “Parse error in ‘$tmp’ at $url\n”;
next;
}
my $code = $1;
$tag = $parser->get_tag(“div”);
my $desc = $parser->get_trimmed_text;
$desc =~ s/’/’’/g; # some descriptions will have quotes
# This creates the needed SQL statement, and optionally writes the
# code and its description to the codes table.
my $query = "INSERT INTO codes " .
"( code_type, code, modifier, code_text ) VALUES " .
“( 2, ‘$code’, ‘’, ‘$desc’ )”;
if ($DBNAME) {
my $usth = $dbh->prepare("SELECT id FROM codes " .
“WHERE code_type = 2 AND code = ‘$code’”)
or die $dbh->errstr;
$usth->execute() or die $usth->errstr;
my @urow = $usth->fetchrow_array();
if (! @urow) {
++$countnew;
}
else {
$query = "UPDATE codes SET code_text = ‘$desc’ " .
“WHERE code_type = 2 AND code = ‘$code’”;
++$countup;
}
$dbh->do($query) or die $query;
}
print $query . “;\n”;
}
}
}
# This starts the ball rolling.
scrape($START_URL);
#######################################################################
# Shutdown #
#######################################################################
if ($DBNAME) {
print “\nInserted $countnew rows, updated $countup codes.\n”;
$dbh->disconnect;
}
/********************ENd of Code Snippet*********************************************************************************************
Please advise,
Monty Appavoo
sunsetsystems wrote on Wednesday, September 15, 2010:
I didn’t mean it would be quite that easy! Someone with knowledge of HTML and perl will need to spend a few hours studying the HTML generated by the site and adapting the logic to it.
klassy wrote on Thursday, March 24, 2011:
hi
i did you guys finally resolve the icd10 issue?
i want to know how to import a database from MS access into mySql
and how do i get the link to icd9data.com to work?
am on Mac OSX