Cosmic rapporten från 2006

Hittade just min egen rapport till Landstinget Uppsala om Cosmic från 2006, om någon är intresserad. Skriver det här så jag inte tappar bort länken igen. Det är klart jag har rapporten själv, men eftersom jag skrev den i uppdrag av LUL är det väl korrektare att endast hänvisa till deras egen publicering av den. Om ni undrar, alltså. Här är den:

Lecture på KI

Till min stora glädje blev jag inbjuden att ge en lecture på Engelska för “International Masters Programme Health Informatics” på Karolinska Institutet och jag gav den förra måndagen. Vi spelade in hela föreläsningen, 3.5 timmar, på video och nu har jag hållit på en vecka för att konvertera, dela in, lägga till slides, fixa ljudet, m.m. Föreläsningen omfattar 12 sektioner, men resulterade i 20 videos eftersom YouTube begränsar till max 15 minuter per video.

Alla 20 finns i en playlist på YouTube:

Lecture notes finns också:

Föreläsningen omfattar allt möjligt som jag har tankar om i Vård IT, och som bekant är det väldigt mycket. Sista sektionen, nr 12, handlar om iotaMed och innehåller även de nya vyerna, dvs kvalitetsregister och kronologisk journal. Den delen är dryga 50 minuter i sig.

Skitbra bok

Den här titeln gav sig själv, liksom, eftersom jag just läst boken “Jävla skitsystem!” av Jonas Söderström.

Boken täcker ett mycket brett spektrum av kniviga frågor, men trots det träffade jag inte på någonting alls, inte en enda punkt, som jag inte höll med om helt och hållet. Den är också skriven av någon med lång erfarenhet i branchen och i synnerhet med användbarhetsfrågor och därmed nästan oförvitlig trovärdighet.


SQL is dead, long live RDF

…um, at least as far as medical records go. SQL remains useful for a lot of other things, of course. But as far as electronic medical records are concerned, SQL is a really bad fit and should be taken out back and shot.

Medical records, in real life, consist of a pretty unpredictable stack of document types, so some form of graph database is very obviously the best fit for storage. Anything with rows and columns and predeclared types, is a very poor fit, except maybe for the patient demographics and lab data. Or maybe not even that.

The problem so far was the lack of viable implementations so instead of doing the right thing and creating the right database mechanism, most of us (me included) forced our data into some relational database, often sprinkling loose documents around the server for all those things that wouldn’t fit even if hit with a sledgehammer. All this caused mayhem with the data, concurrency, integrity, and not least, security.

I have to add here that I never personally committed the crime of writing files outside of the SQL, but squeezed them into the database however much effort it cost, but from the horrors I’ve encountered in the field, it seems not many were as driven as I was. I have, though, used Mickeysoft’s “structured storage” files for that, a bizarre experience at best.

You have to admit this is ridiculous. It leads to crazy bad databases, bad performance, horrible upgrading scenarios, and, adding insult to injury, high costs. Object-relational frameworks don’t help much and without going into specifics, I can claim they’re all junk, one way or the other, simply because the idea itself sucks.

From now on, though, there’s no excuse for cramming and mutilating medical records data into SQL databases anymore. Check out RDF first, to get a feel for what it can do. It’s part of the “semantic web” thing, so there’s a buzzword for you already.

A very good place to start is the rdf:about site, and right in the first section, there’s a paragraph that a lot of people involved in the development of medical records really should pause and contemplate, so let me quote:

What is meant by “semantic” in the Semantic Web is not that computers are going to understand the meaning of anything, but that the logical pieces of meaning can be mechanically manipulated by a machine to useful ends.

Once you really grok this, you realize that any attempts to make the computer understand the actual contents of the semantic web is meaningless. Not only is it far too difficult to ever achieve, but there is actually nothing to be gained. There’s nothing useful a computer can do with the information except present it to a human reader in the right form at the right time. What is important, however, is to let the computer understand just enough of the document types and links to be able to sort and arrange documents and data in such a way that the human user can benefit from accurate, complete, and manageable information displays.

It is almost trivial to see that this applies just as well to medical records. In other words, standardizing the terms of the actual contents of medical documents is a fool’s errand. It’s a pure waste of energy and time.

If a minimal effort would be expended to standardize link types and terms instead, we could fairly easily create semantic medical records, allowing human operators to utilize the available information effectively. All it would take for the medical community to realize this would be to raise their gaze and check out what the computer science community is doing with the web and then copy that. At least, that’s what we are aiming to do with the iotaMed project and I hope we won’t remain alone. What is being done using RDF on the web makes a trainload of sense, and we’re going to exploit that.

In practice, this means that you need to express medical data as RDF triples and graphs. This turns out to be nearly trivial, just as it is very easy to do for the semantic web. It’s a lot harder, and largely useless, for typical accounting data, flight booking systems, and others of that kind, but those systems should really keep using SQL as their main storage technique.

We also need a graph database implementation and we’re currently looking into Neo4j, an excellent little mixed license product that seems to fill most, if not all, requirements. But if it turns out it doesn’t, there are others out there, too. After all the years I’ve spent swearing at SQL Server and inventing workarounds for the bad fit, Neo4j and RDF is a breath of fresh air. The future is upon us, and it’s time to leave the computing middle ages behind us as far as electronic medical records are concerned.


iotaMed is intended as an organizing overlay to existing information. It adds the guideline layer, including knowledge transfer and checklist functionality, to the classic electronic health care record. The information needed cannot be stored in the existing EHR systems, simply because they lack the necessary concepts. In other words, we do need our own database to contain the iotaMed information, even though we may leave all the “old” information where it already resides in the legacy EHR. Even the new information added through iotaMed will result in new information to be added to legacy EHR systems, even though that information, by necessity, is as poor as the information currently stored there. There simply is no way to turn this particular toad (the legacy EHR) into a prince.

So, what do we choose for an iotaMed database, that is for the iotaDB? It’s painfully obvious to most that a relational database is very unsuited to this purpose and has always been. Using relational databases for medical information has never been a good idea due to the unstructured or semi-structured nature of medical data. Every EHR I’ve seen that uses relational databases has been a Frankenstein’s monster of inefficiency and inflexibility. It the wrong choice, pure and simple.

Lately, graph databases are becoming popular, and seem to be a much better fit for this purpose. Entities used in medical databases are practically always of variable structure, with a huge number of possible value types, but with only a small number of value types used in each instance. If implemented in a relational database, this results in sparse tables, or more often in blatant misuse of the database where one column is used to define the value type of another column, so that just about anything can be dumped into a single table. It’s horrible.

The “issue”, “issue worksheet”, “clinical guideline”, “item”, and “observation” objects clearly form a graph that would be difficult to squeeze into a relational DB, but would fit nicely into a graph database.

Currently, I’m looking at Neo4j, since it seems to be one of the more evolved open source graph databases.There’s a nice intro to Neo4j here. Neo4j does not seem to have a language binding for Objective-C yet, and it needs Java to run, but since I’m planning on deploying iPads logically tethered to an OSX machine, the Neo4j can run there. The interface between Objective-C and Java would then effectively be a server side proxy app. If somebody already did this, I’d appreciate hearing from you, though.

A medication change

In the previous post I did a simple medication domain model. After a brief exchange of comments on my Swedish blog, I was quickly made to realize it was far too simple, so let’s see how it looks today:

In this diagram, I’ve replaced the “prescription” object with a “prescription worksheet” that works very similarly to an issue worksheet. It’s all very logical; each pharmacological therapy or product comes with a set of guidelines that include when it’s to be used, what steps to take before using it, what values to check, etc. All of this is very similar to a clinical guideline but centered around a prescription. So it makes a lot of sense to treat it almost exactly the same way as issues, except it isn’t kept at the same position in the object dependency tree. We don’t want the prescriptions up there commingling with diseases, but rather somewhere lower in the tree.

However, the items and the values of those items (“observation”) can overlap with those used in issues. For instance, the item “creatinine concentration in serum” can be used both in an issue and a prescription worksheet, if the prescription guideline says that the product should not be used, or used differently, in renal failure. So some items will be used in prescriptions, some in issues, and some in both.

Medication Domain Model

In conventional EHR systems, medications are usually just a list found under the patient. The problem here is that there is no direct relationship between the medication and the reason it is administered, simply because there is no concept that could function as “reason”. Lucky us, with iotaMed we do have “issues” so that’s what we’ll use.

A “prescription” is an order for a particular drug, for example “Aspirin, twice daily”, while a “refill” is the order to the pharmacy, for example “Aspirin, box of 100”. (Highly simplified.)

Since a “prescription” is for a particular issue, that is a particular symptom or disease, it should be a child of the issue in some way. Since it will typically appear in a clinical guideline under the section “Treatment”, it will appear as a line item.

Encapsulated lifetime

If you look carefully, you’ll see that each “prescription” can relate to more than one “issue worksheet”, which allows it to relate to more than one “issue”, since a different “issue worksheet” belongs to another “issue”. This is necessary since a prescription could serve a purpose for more than one disease. For instance, an ACE inhibitor is beneficial both in heart failure and to prevent diabetic kidney problems. And it is also used to treat hypertension.

Making “prescriptions” dependent on “issues” makes it much easier to stop medications when they’re no longer necessary. What we often see in practice today, with the crippled EHR systems we have, is that medications are continued indefinitely since it is often unclear exactly why it was started in the first place. Most systems allow a comment to be printed on the medication label describing the intent in a language the patient is meant to understand, but this is just a bad workaround. Often it is not filled in and if it is, it is sometimes incomplete. It is, after all, just a text field.

In iotaMed, however, it is abundantly clear exactly why a medication is prescribed and this allows the system to prompt for continuation or interruption of the prescription as the issue itself is activated or deactivated. Using an object term, we can say that the “lifetime of the prescription is encapsulated in the issue lifetime”, as it should be.


Current EHR systems usually issue warnings for interactions between prescribed products. This isn’t as great as it is made out to be. Generally, these systems stink. They throw up meaningless and frankly ridiculous warnings so often that nobody pays attention anymore. I can’t count the number of times our system has warned me that eardrops can cause unwanted pregnancies. I kid you not.

Also, interactions aren’t the main problem we have with medications. The main problem is contraindications, but since EHR systems can’t handle that, we’re supposed to believe that interactions are more important. Don’t fall for it, they’re not.

All medications have a list of contraindications, that is, conditions that if present makes their use dangerous. Some drugs for urinary problems, for instance, may not be given if the patient has glaucoma. A number of products should not be given if the patient has prostate problems, or heart problems, or asthma, or any number of other conditions. But if the EHR system has no idea what diseases and conditions the patient has, it can’t detect contraindications and there you are.

iotaMed, however, is built on the presence of issues, which are exactly those conditions we need. If we try to prescribe a medication for one condition that is contraindicated in the presence of another condition which the same patient has (as an issue), then the system can easily point out the conflict and stop you from doing something really stupid.


Jag skrev ett svar på ett inlägg på Vård IT Forum om grundkraven på nya journalsystem och beskrev vad jag håller på med i ett antal punkter. Jag beundrade mitt eget svar så till den grad att jag helt enkelt tar över det från mig själv och publicerar det idag.

Just nu jobbar jag heltid med att göra en prototyp av det journalsystem jag tycker vi behöver. Grundprinciperna är:

  • Öppen utveckling: design och resultat ska vara publikt tillgänglig
  • Användning av open source när det är görligt
  • Användning av ny teknik på klientsidan, i synnerhet vad gäller UI, vilket i dagsläget betyder iPad och OSX
  • Hel nystart vad gäller journalen, fullständig byggd runt “issues”, vilket är symptom eller sjukdomar, inte kontakter
  • Sekretess runt “issues”, inte avdelningar
  • Direktkoppling av medicinering till “issues”, vilket tillåter varning på kontraindikationer isf enbart på interaktioner
  • Total integration av vårdprogram i “issues” (se nedan)

Integrationen av vårdprogram i “issues” innebär:

  • Omedelbart kunskapsstöd till läkaren vid patientkontakten
  • Omedelbar uppdatering av kunskap enligt senaste rön
  • Direktkoppling till kvalitetsregister via vårdprogrammet i “issue”
  • Extrem förenkling av beställningsförfaranden som labb, med både beställnings och tolkningsstöd direkt i journalen
  • Extrem förenkling av remissförfarande, eftersom motivation, anamnes och status nu sker automatiskt från “issue”

Just nu håller jag alltså på med prototyputveckling av UI för iPad. Jag har ingen avsikt att behålla det här för mig själv och är mycket intresserad av att andra vill hjälpa till. Varje form av samarbete är tänkbar och förslag mottages gärna. Jag tänker också publicera screenshots vartefter, åtminstone om jag inte behöver skämmas för dom alltför mycket.

Vård IT Forum är stället där vi kan diskutera detta, men jag är även mottaglig via email, naturligtvis.

“Issues” och konfidentialitet

På min ursecta blogg beskriver jag idag hur man kopplar sekretess till “issues” isf läkare, avdelningar, eller notat. Det löser en mängd problem och kan t.o.m. lösa problemet där sjukdomar som är viktiga i andra sammanhang förblir okända i nuvarande system.

Just idag fick vi vår 100:e medlem på Vård IT Forum! Stort grattis till mig själv! Tackar, tackar! Medlemslistan börjar bli ett litet Who’s Who av personer och företag inom vård IT i Sverige. Vi har mer än 350 inlägg i 80 olika ämnen för ögonblicket.

Framtidens IT i vården