Database browsing with Django

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?

Advertisements