Archive for July, 2006

Vim, UTF-8 and ISO-8859-2

2006-07-18

About four years ago I had to fiddle with Vim to make it edit an UTF-8 encoded file, while my terminal (and system) used ISO-8859-2.

I use UTF-8 as the default encoding today. How to edit with Vim an ISO-8859-2 file when my system uses UTF-8?

The first thought was to make it the same way as before, just swapping the parameter values: set encoding to ISO-8859-2 and termencoding to UTF-8. Unfortunately, it doesn’t work!

After some RTFM’ing, I learned about the fileencoding parameter, but setting it to ISO-8859-2 didn’t fix the problem. This was to be solved in a different way.

Vim will automatically guess the file encoding, as long as the encoding is listed in the fileencodings parameter. I use only UTF-8 AND ISO-8859-2 (alias LATIN2) encodings, so adding following line to the ~/.vimrc file fixed the problem:

set fileencodings=utf-8,latin2

Database browsing with Django

2006-07-17

After few days of building a database browsing tool with Django, I must say: Django is brilliant!

Example patient information
I have set up browsing for all the major database entities: hospitals, surgeons, patients, operations and factors (a factor is a disease, procedure, etc). The database browsing website is intensively interlinked. Every hospital, surgeon, factor, etc is linked, so you can click it and follow to information about it.

Almost everything was done using the generic views, which means that I didn’t have to write the views myself. I decided to migrate the data instead of using the legacy tables directly. It required a bit of work with migrating the data, but I wanted to have pure Django-generated tables. Besides reading the Django documentation, what I have done was:

  • Write models for my data: Hospital, Surgeon, Patient, Operation, Factor
  • Move the data from the old tables to Django tables
  • Generate slugs for nice URLs (slug-is-this-king-of-string)
  • Design URLs (/hospitals/, /hospital/CODE/, etc)
  • Write templates (hospital_list.html, hospital_detail.html, etc)

The next major task will be creating the “related factors” view. It seems like I’ll have to write a custom SQL query for that. The question is: having a given factor (tag), what else factors are associated with patients with my given factor?

Freemind

2006-07-10

I wrote about the kdissert some time ago. After some research I found a similar project, Freemind. Here’s an example screenshot:
Freemind tree example
I like Freemind more than Kdissert for three reasons:

  • Allows keyboard-only data entry. You can use arrow keys to navigate, ENTER to create new nodes on the same level and INSERT to create leaf nodes, F2 to edit note text. This is a great advantage, because mouse usage slows down the process.
  • Does automatic on-screen layout, so you don’t have to waste your time on manual node positioning.
  • Has convenient (press SPACE) branch-collapsing, which allows you to temporarily hide some parts of the tree. Useful especially if you have large and flat tree structure. Please look at the leaves that have little circles on the ends. They are collapsed branches.

Freemind is written in Java and available for Linux, Mac and Windows™.

What’s a diagnosis?

2006-07-09

The EACTS Congenital Database website states:

The resulting the International Nomenclature for Congenital Heart Surgery including the Minimum Data Set of 21 items and the lists of 150 Diagnoses, 200 Procedures, 32 Complications, as well as 28 extra cardiac anomalies and 17 preoperative risk factors.

What’s a diagnosis, anyway? Is VSD a diagnosis? No, it’s a disease. So are Tetralogy of Fallot and Hypoplastic Left Heart Syndrome. We can talk about a diagnosis, when certain disease is identified within a patient.

Diagnosis can be also referred to as a set of identified diseases. This is unfortunate, because the nomenclature contains now sets of diseases, for example TGA+VSD. The dictionary of disases should contain single diseases only, and the diagnosis should be defined as a set of previously defined diseases, identified within a patient.

Tool for the database exploration

2006-07-09

I decided to revive my idea of the database exploration tool. It won’t be static HTML files generator, it’ll be a mod_python based web service. Sometimes I wonder, why such tool wasn’t developed before. Now, since I’m starting to make the analysis, I’m becoming a real database user, not an administrator.

Despite I try to create a general tool for the data analysis, I can’t avoid looking at the data directly. I need to examine the data in many ways, and it’s often necessary to look at the specific patient histories to find out, if a special combination of factors was an data entry error, special case or a kind of case that wasn’t considered before.

I want to have trendy URLs, like:

http://server/patients/some-patient-id/

http://server/diagnosis/tof/

http://server/diagnosis/tof/male/

First thought was the mod_python and all custom code, but after some research, I decided to try Django. Its homepage says:

Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.

The tutorial showed how to get a simple poll service in no time. It deals with the database structure as well. I’ll need to build a Django model for my database and port the data, and then I’ll be able to build a browsing interface very fast. And I’ll have my trendy URLs.

Barumba and Stone Cold Heart

2006-07-07

I just found out that my favorite band Incognito used the same drum loop for two songs:

  • “Barumba” from “100 And Rising”
  • “Stone Cold Heart” from “Who Needs Love”

I listened to Barumba for many years now and I love it. However, the newer (2002) song “Stone Cold Heart” fits very well with the loop, and I appreciate the perfection of Incognito’s arrangements, sound and mixing.

Encrypt your home directory

2006-07-07

Current encryption HOWTOs tell about encrypting the whole /home partition, but how to enrypt only your home directory with your own password?

My friend has written a HOWTO: Encrypted home on multiuser system.


Follow

Get every new post delivered to your Inbox.

Join 474 other followers