HL7 FHIR OBSERVATIONS
As the HL7 documentation describes, Observations are a central element in healthcare, used to support diagnosis, monitor progress, determine baselines and patterns, and even capture demographic characteristics. Most observations are simple name/value pair assertions with some metadata, but some observations group other observations together logically or can even be multi-component observations. The DiagnosticReport resource provides a clinical or workflow context for a set of observations. The Observation resource is referenced by DiagnosticReport to represent laboratory, imaging, and other clinical and diagnostic data to form a complete report.
Uses for the Observation resource include:
- Vital signs such as body weight, blood pressure, and temperature
- Laboratory data like blood glucose or an estimated GFR
- Imaging results like bone density or foetal measurements
- Clinical findings such as abdominal tenderness
- Device measurements such as EKG data or pulse oximetry data
- Clinical assessment tools such as APGAR or a Glasgow Coma Score
- Personal characteristics such as eye colour
- Social history like tobacco use, family support, or cognitive status
- Core characteristics like pregnancy status or a death assertion
But first, some explanation...
CBC TESTS
This demo focuses on several blood observations which are part of a complete blood count (CBC). CBC is a group of tests that evaluate the cells that circulate in the blood, including red blood cells (RBCs, or erythrocytes), white blood cells (WBCs, or leukocytes), and platelets (PLTs, or thrombocytes). The CBC can evaluate your overall health and detect a variety of diseases and conditions, such as infections, anaemia, and leukaemia. Blood cells are produced and mature primarily in the bone marrow and, under normal circumstances, are released into the bloodstream as needed.A CBC is typically performed using an automated instrument that measures various parameters, including cell count and the physical features of some of the cells. A standard CBC includes:
Red blood cell tests:
• Red blood cell count – the actual number of red blood cells in your blood sample.
• Haemoglobin – the total amount of the oxygen-carrying protein in the blood, which generally reflects the number of red blood cells in the blood.
• Haematocrit – the percentage of your total blood volume that consists of red blood cells.
White blood cell tests:
• White blood cell count – the total number of white blood cells in your blood sample.
• White blood cell differential – may be included as part of the CBC or may be done in follow-up if the WBC count is high or low.
For Observations, like the results of such CBC tests, there are several endpoints available. Using Swagger UI “allows anyone – be it your development team or your end consumers – to visualize and interact with the API’s resources without having any of the implementation logic in place. It’s automatically generated from your OpenAPI Specification, with the visual documentation making it easy for back end implementation and client side consumption.”
ADD A RED BLOOD CELL (RBC) OBSERVATION
Let’s go through the typical data flow and create a new red blood cell observation. For this purpose, I will use the api/Observation/AddRedBloodCellCountObservation/1845361/4.9 endpoint and send the following Patient ID (1845361) and value (4.9) in a request. The result is a new observation:
DIG INTO THE CODE
Let’s look at the details. After the model validation in ObservationController, we call ObservationService with the AddRedBloodCellCountObservationAsync method.
OBSERVATIONBASE MODEL
REDBLOODCELLCOUNT MODEL
OBSERVATIONDTO MODEL
Find example source code for this series on Endava’s GitHub.
PREREQUISITES
Visual Studio 2019 16.8.1 or higher.NET 5.x
TAGS, TECHNOLOGIES AND SOURCES
Swagger – interactive API documentationAPI-Docs – friendly API documentation
Serilog – flexible, structured logger
FluentValidation – a popular .NET library for building strongly-typed validation rules
Firely .NET SDK – the official HL7 FHIR SDK in .NET
ADDITIONAL RESOURCES
Extra documentation for FhirClientHL7 FHIR Restful API specification
Firely.NET SDK FHIR Community
List of FHIR test servers
* HL7® and FHIR® are the registered trademarks of Health Level Seven International.