*(This is a guest post by my colleague Martijn, who is implementing FHIR Profile validation for the .NET reference implementation)*

As reference implementers of FHIR, we try to fully understand the possible difficulties that future FHIR implementers would encounter. When we can, we try to build the full implementation, including the optionals. We did full monty with the implementation of storing and searching for quantities. Which was not an easy but very interesting path, which I will try to tell you all about in this and the next to blog posts.

To get you up-to-speed, let’s start with a small recap: Quantity is one of the core data types in FHIR. It is used to communicate and store physical measurements. Doctors do it. Nurses do it. And especially laboratories do. A quantity basically consists of a value and the unit that the value expresses. For example [3 liter]. So far so good. Doesn’t look too difficult. The truth is both the value and the unit have a their share of serious challenges.

A unit is not simply a unit, but actually a compound of units with prefixes that have multiplications and divisions. For example pressure: Kilo Pascal per square meter (kPa/m^2). It gets more complicated: in the US this measurement would be expressed in pounds of force per square inch. The measurement is the same, but value is completely different. Yet in the end we do want to compare them.

As well, a conversion of 1 kilo to 1,000 gram is not a mere multiplication by 1,000. Because a measurement has precision, 1 Kilo Pascal is not the same as 1,000 Pascal. It’s the same as 1e3 Pascal (or 1 times 10 to the power of 3), and the value is 1000 times more precise than 1e3.

In the next two separate posts I will tell you how we dealt with the units and the value issue. If you can’t wait to check it out, take a look at the Metric library, right here