See the HealthVault Data Type Wiki for current information on using this type.

This document contains general guidelines for using the Lab Test Results data type. It covers the members of the data type where we believe guidance is most useful, and does not cover members that are easily understood. See the LabTestResults class documentation for information about all members.

The lab test results data type can support many different types of lab data, and is therefore complex to understand. We will look at a few sample scenarios to illustrate how to structure data, and then go into the details of the data elements.

Storing a single test result

To store the result of an insulin test, we will create a single group named “Insulin”, and then add a single result to it. In a complex data type, it is often simplest to create most detailed data first. We’ll start by storing the result and reference range:

StructuredMeasurement value = new StructuredMeasurement();
value.Value = 17;
value.Units = new CodableValue("mcIU/ml", new CodedValue("uIU-per-ml", "lab-results-units"));

GeneralMeasurement measurement = new GeneralMeasurement();
measurement.Display = "17 mcIU/ml";

TestResultRange resultRange = new TestResultRange();
resultRange.RangeType = new CodableValue("Reference range");
resultRange.Value = new TestResultRangeValue();
resultRange.Value.Minimum = 3;
resultRange.Value.Maximum = 28;
resultRange.Text = new CodableValue(String.Format("{0} - {1}", resultRange.Value.Minimum, resultRange.Value.Maximum));


The numeric value is stored in a StructuredMeasurement instance, and added to the GeneralMeasurement, which also stores a textual value suitable for display to the consumer.

The result range is stored in the TestResultRange.

These are combined together:

LabTestResultValue resultValue = new LabTestResultValue();
resultValue.Measurement = measurement;

into the LabTestResultValue. We will now create the LabTestResultDetails instance, which holds the information about a test and the result:

LabTestResultDetails details = new LabTestResultDetails();
details.Name = "Insulin";
details.ClinicalCode = new CodableValue("Insulin SerPl-sCnc", new CodedValue("20448-7", "loinc", "regenstrief", "2.22"));
details.Substance = new CodableValue("SER/PLAS");
details.When = new ApproximateDateTime(new DateTime(2009, 10, 10, 3, 23, 24));
details.Value = resultValue;
details.Note = "Insulin levels must be evaluated in context.";

The Name element holds a consumer-friendly name, and the clinical code holds the clinical name and code for the test.

We will now add this test to a test group:

LabTestResultGroup group = new LabTestResultGroup(new CodableValue("Insulin"));
group.LaboratoryName = new Organization("Lab");
group.Status = new CodableValue("C");

The group stores a set of tests that are done together. In this case, we only have one test result to add.

Finally, we wrap this up in the top-level object, and save it out to the record.

LabTestResults labTestResult = new LabTestResults();
labTestResult.OrderedBy = new Organization("General Hospital");
labTestResult.When = new ApproximateDateTime(new DateTime(2009, 10, 10, 3, 23, 24));


Storing a panel of tests

Storing a panel of tests is the same as storing individual tests, except that multiple results are added to the group, and the group name should be the panel name (“CBC”, for example).

Adding explanatory information

If there is additional explanatory information that is important when interpreting a test result, they can be placed in the Note member of the result (see the first code sample). The Note member supports pre-formatted tabular information (carriage returns and tabs are preserved in the output). This allows Note to be used for information such as the following:

                      Male            Female
Cord Blood              <17.400          <17.400
1-3 Days                <13.300          <13.300
1-4 Weeks        0.600 - 10.000   0.600 - 10.000
1 Month-5 Years  0.550 -  7.100   0.460 -  8.100
6-18 Years       0.370 -  6.000   0.360 -  5.800
Adult            0.450 -  4.500   0.450 -  4.500


The HealthVault shell will preserve this formatting when it displays the Note – other applications should do the same thing.

Non-numeric test results

Some lab tests do not return a quantitative result, but instead have a narrative or qualitative result. These results can also be placed in the Note field, and if range information is included, it can be stored in the Text member of the TestResultRange.