ICD9 data are the diagnosis and procedure codes used by insurance companies to categorize, well, diagnoses and procedures to be determined / performed by medical professionals. Typically, if you visit the doctor for an ailment and file insurance, your provider will list the reason for the visit, any diagnoses, and any procedures performed. This is then sent to the insurance company for processing. They can then use codes to indicate if the procedure is covered, as well as, (for example) determine if the diagnosis was a pre-existing condition. The data is a simple hierarchical structure which is shown in the following diagram.

ERD for storing ICD9 data

ERD for storing ICD9 data

We see that diagnoses can have sub-diagnoses, etc. I used this simple structure, and added a qualifying column of ‘record_type’ to indicate if the code listed was an actual diagnosis, or a section header. Sections of diagnoses are part of the data, and can be used in searching the database. This diagram offers a simple and quick design to handle the data given.

Comments are welcome.

I’ve long neglected this blog, and the power behind it to discuss my feelings toward database design.  Proper database design is the backbone to a solid application.  Failing to correctly normalize tables and enforce business logic with foreign key relationships can cause undue headaches.

What I’ll be doing is going through some simple applications, and start modeling the tables and relationships, and intersperse some commentary where useful.  The discussion depends on interaction, and I’m of the opinion that a ‘good’ database designer can a) defend their design articulately and b) know when to concede a good point.

Database design is becoming organic.  Strict adherence to the normal forms isn’t required any longer.  Let me be clear though, denormalizing a table to make things easier for a developer is not a valid reason to denormalize.

The modeling tool I’ll be using for generating the images is MySQL Workbench.  Workbench is a very powerful tool, from the source of one of the most powerful (and used) databases today.  I cut my teeth on database design with DBDesigner4, whose creator went on to work for MySQL Workbench.

Stay tuned.

16
Sep
stored in: General and tagged: , , , ,

Stef and I recently switched phone providers, and thus, could take advantage of the latest deals. Well, Verizon had a buy one get one free offer on Blackberry phones. Step went with a Curve and I went with a Storm. Not having a physical keyboard takes some getting used to, but the Storm screen actually clicks, which makes it really feel like you’re typing. Compared to the typing I’ve done in the iphone, I really prefer the feedback.

I’m still looking for a calendar sync (online, but not Google) that I can setup on my own server. If anyone has an idea, please leave a comment.

27
Jul

This weekend, I watched (again) one of my childhood favorite movies, WarGames. This is a classic, and a must see for anyone involved in technology. Some of the concepts used, are accurate (war-dialing) while others, a little far-fetched (war-dialing into NORAD). Anyways, in one scene the WOPR  is running a simulation of a USA/Russia attack. One of the computer technicians views his screen and sees the continental US surrounded by 10 – 15 ‘red’ submarines. He turns to his colleague and says “Hope you like vodka…”. 

I then thought to myself, what an interesting state of mind to be in. Growing up, and even today, I would laugh at the idea of another country attacking us, and having any sort of success.  But, I realize there was/is a time in our history (and today) where we have vulnerabilities, and we’re not necessarily the huge powerhouse I grew up thinking we were.  That said, it was interesting to see the characters in the movie, playing technicians in one of the safest places in the world, and they assume the Russians would clean up.

My boss used an analogy today, which struck me as quite accurate for the position we’re currently in.  We’re moving at a fairly rapid pace, quick releases, and plenty of improvements / changes.  Along with this, there is new business, new ideas, and new potential sources of revenue that we’re working on.

Assuming that the speed of the vehicle is constant, and the winding is fairly unknown, how do you best prevent hitting the walls?  This part of the analogy is talking about software quality.  While no one is perfect, reducing the amount of churn on bugs and enhancements allows for time better spent on other things, be it additional bugs, new enhancements, or time to re-design the credit card processing module to be more efficient.

In keeping with the analogy, I tried to think of various methods to implement, which prevent hitting the wall.  The first, posed by my direct superior was to ‘increase the accuracy of the driver’.  This is the ideal solution, all things the same.  But, what other factors contribute?

Part 1 – Size of the car

Reducing the size of the car will generally improve the accuracy of the car.  Now, with this analogy, I’m thinking in terms of relative extremes, and I won’t delve into the nit-picks of which 2-door sport coup is the best for suspension.  So, consider 2 vehicles.  1 – a smaller 4-door sedan, low-profile, but consistent acceleration / braking.  2 – an eighteen wheeler – hauls, but reaction time is limited, and said reactions are greatly exaggerated.

A smaller car here represents a focused small unit of developers.  These developers are typically the medium-high to high performers, able to deliver on quality in terms of fixing an issue, and in terms of overall design and architecture.  They work closely together in a nice cohesive environment, with limited distractions.  This allows for quick reactions to change, more rapid context-switches between projects, and good performance.  But, the amount of total ‘fixing’ they can do is limited (they’re in a sedan, for petes sake!).

A big rig here represents a bigger team, with a wider range of skillsets.  You have the higher performers, but also the medium-lows (no lows here, that’s just not pleasant).  Likewise, the medium-lows can deliver, and the solutions work, but they may not be fully thought out, they may not consider some design flaws in their solution which could impact maintainability down the line, but they _can_ deliver a solution.  This team moves along quickly, making a lot of changes, but with unexpected turns ahead, the reactions and turns cause turmoil and disruption.  But, at the end of the day, there is quite a bit of things being fixed, the worry though is, is it being _really_ fixed?

Is the amount of items being fixed the goal?  Or, can you afford to delay a while, but in the end deliver a more solid product?  Over time, the lines will converge, and the products will more than likely appear similar, and operate fine, but did your reputation suffer along the way?  Are customers willing to wait, if they know the problem will be resolved to their complete satisfaction?  Or, do customers accept a partial solution, and potential headaches, but know that eventually the problem will be fully resolved?

07
Jul
stored in: General and tagged:

In health news – I’m getting my gallbladder removed tomorrow.  It should be interesting, as it will be my first official surgery.  I had my wisdom teeth out (3 of which were impacted) and was put under for it, but I didn’t really consider it a sugery-surgery.

I’m getting it done laparoscopically so the recovery time is actually quite limited.

For anyone with a strong stomach – you can watch a video of how this is done here: http://www.dailymotion.com/video/x1merv_laparoscopic-gall-bladder-removal_shortfilms

I had a HIDA scan which confirmed the diagnosis that my gallbladder was busted.  A normal person has an ejection fraction of about 35% – which means, your gallbladder squeezes out 35% of it’s contents during normal operation.  My ejection fraction was 2% – so, either something is blocking the duct, or my gallbladder is, well, busted.

Either way, the recommended course of action was removal.  Being young and it good health, it’s the best time to do it.

As another aside – the HIDA scan uses a radioactive isotope to trace the gallbladder function.  Injected via IV, it is taken up by the liver and deposited into the gallbladder.  Then, a technician can watch the isotope as it leaves the gallbladder into the digestive tract.  Anyways, the radioactive bit – I took a full day for the scan, since the College World Series was also in town, and I wanted to catch a game.  Well, on my way to a seat, a Omaha Firefighter runs past me with a beeper looking device which was…beeping.  I thought little of it, thinking there must be a medical emergency.  As I found a seat, I noticed the same man, walking the rows with his beeper.  He narrows down to my area, and then I see his colleague with a geiger counter.  At this point, I’m still thinking, no way is this related to me and the HIDA scan.  Well, when the man with the geiger counter sat down behind me, I could read the awkward look on his face.  He then asked in a kind voice, “Hi, have you had any radiation treatment recently?” – I then explained the HIDA scan, etc.  I reassured them that, no, I was not a terrorist, nor was I hiding radioactive materials / weapons.

06
Jul
stored in: General and tagged:

I use VirtualBox fairly regularly for virtual machines of various types (XP under Debian, FreeBSD, etc) on my main desktop. Compared to VMWare I have no complaints. It works flawlessly, and with the latest release things are just polished.

Also, it now supports OpenGL for guest VMs. This is huge for graphics work / gaming, etc. No more dual-booting. With RAM as cheap as ever – there isn’t a reason why VMs don’t fit the bill for servers anymore.

Lastly, but more importantly, VirtualBox is free.  Yes, free.  It’s a quality product, and really meets my expectations for virtualization.

04
Jul
stored in: General and tagged:

Today is the day we remember our freedom and the rights we enjoy as citizens of this great nation.  I’d like to take this opportunity to thank any and all members of the military – as well as anyone who has contributed to the continued fight for freedom.  The rights we enjoy as citizens should never be taken for-granted, nor should they be compromised for any reason.  I won’t turn this into a political post about rights infringement, but, I am grateful for the freedoms I have – and pray they’re never taken away.

Have a safe and happy 4th of July.

03
Jul
How much math Ive used past grade school.

Today’s ‘Friday Fun Post’ maybe be an old one for some of you, but it is something I have continually found amusing.  It is somewhat of a sad truth, but a truth nonetheless for the majority.

Happy Friday!

02
Jul

I have an older laptop, which I brought back out of storage for fun and to keep it updated. It runs Debian Lenny, so it’s a pretty stable machine, and very handy. A recent purchase of a new battery gives me ~2.5 hours of time with it, which isn’t bad for a laptop from Fall 2002.

Anyways, with running Linux, sometimes you’ll run into small glitches which become slight annoyances when you realize how life could be. In the case of our HP Mini – I know suspend to RAM works in the latest kernels, and my older laptop supports ACPI. So, I ventured to solve the suspend to RAM problem. I found that after suspending, upon resume, the laptop would appear alive, but only the backlight would be on. No graphics, no text, nothing. I could SSH into it, and noticed that an XOrg process was eating the CPU. After researching a bit of history on XOrg and nVidia, I found a forum post noting that this particular user had encountered success by turning off nVidia’s AGP handling. Upon testing the following config (/etc/X11/xorg.conf – In the ‘Device’ or ‘Screen’ section)

Option "NvAGP" "0"

I found I could suspend, and resume with ease. What a great community behind these types of things.

I’ve been thinking about obligations to software customers lately.  I don’t have any of my own (yet) but it is something typically on the front of my mind.  At my day job, we maintain various versions of our software, while not directly on the client – in our backend systems.  This means that our backoffice must be able to handle multiple versions (major and minor) for our customers.  Why is this an issue, or something worth writing about?  Because it is such a pain – and customers expect things to ‘just work‘.

This is an especially difficult problem when writing reports, let alone, multi-location reports – where the data is brought in and aggregated from multiple sources into a single report.  The reports become a mess of if/else based on the structure of one location compared to another.

So, this leads into the topic of End-Of-Life for versions.  As stated above, these reports specifically, become large and painful to update.  What is the solution?  In my opinion, it is having sane expiration dates on the software you support.  This has a couple benefits, some direct and some indirect.

Direct:

  • More errors fixed in later versions
  • More features

Indirect:

  • Less maintenance on the backend
  • Quicker feedback on software – if user base is larger.
  • Reduced support costs (ie, helpline) for archaic versions where knowledge experts may be limited.

There are some drawbacks though.  Fear of change is sometimes warranted with business critical applications.  Sometimes, customers are just fine running the current version, and don’t want to change for fear of unknown issues, loss of data, or worse yet, loss of customer data.  Likewise, if this process isn’t started from the beginning, the upgrade processes may not be ironed out, and this causes great heartburn if the process is not seamless for the end-user.

But, back on topic – what is a sane value for end-of-lifeing a software package?  Is it six-months? 18-months?

In my opinion, it largely depends on the rate at which you update your software.  But, largely, 1 major versions back from the current major/minor version is sufficient.  So, if your current release is 5.1 – anything beyond 4.1 should be end-of-lifed.  Your customers should have enough time within the minor releases to react, prepare for any upgrades, and your support staff / developers will appreciate the forward momentum.  This of course assumes a reasonable release cycle.  If you’re releasing more often than a minor version every 3 months or so, increase the number of versions you wait.

What do you think?  Too aggressive?  Not aggressive enough?

01
Jul
stored in: Development and tagged:

With the recent license change at Nokia/Trolltech for Qt – I’ve grown more interested in learning proper GUI development, specifically with C++. I know there are bindings to other languages, but for simplicity of deployment, I think C++ will be easiest to test / depend on, as well as protect in the event that I create something of actual value.

So, outside of the context of Qt, specifically, what are the best practices for organizing C++ projects? I’m used to packages in Java for code organization, do people follow similar suit with C++? In looking at a large project like KDE, it seems that for the bulk of utilities / applications, the code is organized in a single directory, not necessarily split out (as might be the case with a Java project).

Are namespaces worth it? At what size of a project would they add value.

Recently I encountered an issue at work.  I had recently merged some code, and someone who tested from start to finish said there was an error right off the bat.  Crap.

Looking at the error, my blood began to boil:

PHP Fatal error: Column count doesn't match value count at row 1

So, I investigated where this was happening, and found it.  Effectively, when you write an INSERT like this:

INSERT INTO table VALUES ('1', '2', '3');

The DB will automatically match your values up with the columns.  Except, you’ve effectively broken the code because any change to the schema will change the number of columns.  Second, you cannot guarantee the column order on a table, so you just broke any chance of compatibility with another DB back-end.  Especially, in the case of multiple branches of a project being updated, you must be defensive about coding practices against the database.  You cannot assume anything about the mainline of development beyond your branch.

So, a small lesson.  Anytime you’re writing an INSERT, always, always, always, declare the column listing like so:

INSERT INTO table (col_1, col_2, col_3) VALUES ('1', '2', '3');

Now, you see that the DB doesn’t have to think about which columns you’re populating, you told it directly.  This also guards against the change in column order, as well as, the addition of new columns.  Remember, if you’re adding columns that are set to ‘NOT NULL’, be sure to set a sane acceptable default, and you shouldn’t have compatibility issues with your old inserts.

Closing side benefit, I can look at this new INSERT, and know what the columns are.  Given the first, I’d have to go check the DB, and verify the column order, etc.  Always put column names in.  Always.

22
Dec
stored in: General and tagged:

I recently purchased a new HP Mini.  Love the form factor, as does Stef.  It’s great for checking e-mail, web surfing, etc in the living room while watching TV.

First thing I did was drop Windows in favor of Linux.  In this case, Ubuntu.  I found that everything worked flawlessly except I couldn’t SSH out.  After searching around a bit, I found the solution, which I’ll post here in hopes that it saves others some time.

In /etc/network/if-pre-up.d/wireless-tools , add the following line at the end of the file:

/sbin/iwpriv eth1 set_vlanmode 0

And restart networking.  You should now be able to SSH in/out of the HP Mini.

30
Sep
stored in: General and tagged:

Put new floors in the hearth room & kitchen. Finished up a week or two ago. Really took about 20 hours tops, with the help of a good buddy. Still need to decide what to do about trim (floorboards, base shoe).

18
Sep
stored in: General and tagged:

I use DBDesigner4 for DB modeling and ERD generation. Great tool, though the original developer went to work for MySQL (I think) to build their MySQL Workbench. Well, for Linux users, Workbench isn’t available yet, so we can still use DBDesigner4, which works great. Anyways, so I recently attempted to connect to my local MySQL 5 instance, and couldn’t connect. Consistent errors stating invalid username/password, even though I clearly typed it with no errors.

The issue is rather simple. The library used by DBDesigner4 uses an older version of the MySQL API to connect. Meaning, in between versions, MySQL changed the method by which passwords are stored, therefore the authentication would keep failing. Enter ‘OLD_PASSWORD‘. By setting your password using the ‘OLD_PASSWORD’ method, you can connect up with DBDesigner.

Example:

mysql> set password for ‘user’@’host’ to OLD_PASSWORD(‘mysecret’);

04
Sep
stored in: General and tagged:

Gazed out my window to see the Google Car driving up my street. With cat-like reflexes I grabbed my camera and snapped a few photos from the front door.

What’s funny is, now when the pics appear on Google, the world will see me standing in my front door…

Turning from the circle.

Google car driving away...notice the tripod on top

18
Aug
stored in: General and tagged:

Made a couple small feature updates to my Twitter client. Added in a tabbed interface to handle main updates, replies, and direct messages. Added a simple ‘About’ window (what app would be complete without one?), and the beginnings of a simple context-menu to facilitate easier replies / direct messages. Next up, posting.

A couple screenshots:

Showing Tabbed Interface

Showing Replies tab functionality

Showing initial context menu work

Good ol\' About Window

11
Aug
stored in: General and tagged: , ,

Over the last few weeks I’ve had the itch to learn Python. Specifically, in the GUI context. I poked around, looking at a few of the widget sets out there, and settled on GTK. GTK is cross-platform, works on *nix, Apple, and Windows, pretty seamlessly. The integration is quite nice as well. My pet project to increase the speed at which I’m learning (as opposed to just ‘Hello World’) is a Twitter client. Most of the Twitter clients written today are for the Adobe AIR platform, which limits use to Windows & Apple.

I’ll post as I make more progress, but a couple simple screenshots should suffice for now:

Config Dialog

Main Window

31
Jul

So, a blind guy walks into a store with his seeing eye dog by his side. He proceeds to pick up the dog by the hind legs, and starts swinging him around the aisles. A clerk approaches and asks “Is there anything I can help you with, sir?”, to which he responds “No thanks, just taking a look around”

Ba-dum-ching!