KNIME logo
Contact usDownload
Read time: 5 min

Automating TPN Calculation in KNIME for Quality Care

August 31, 2022
Data visualization
Total-parenteral-nutrition-calculation.jpg
Stacked TrianglesPanel BG

You are the clinical pharmacist in the internal medicine team at your hospital. During morning rounds, you see a new patient who was admitted that morning for an 8-day history of nausea, vomiting, abdominal pain and fever. The physician taking care of the new patient tells you they have tried to place a feeding tube in his nose but he keeps pulling it out. Until they find a diagnosis for his N/V the team wants to start a TPN and asks for your help.

Patients hospitalized for serious illnesses or injury are often unable to obtain their daily nutrition needs orally. Lengthy treatments can mean that patients with gastrointestinal absorption issues, obstructions, or persistent hemorrhages, for example, are not allowed anything by mouth for several days, and more1.

Total Parenteral Nutrition, also known as a TPN, provides patients with their daily nutritional needs via their bloodstream. TPNs are vital in healthcare because they provide life-saving nutrition for people with intestinal failure. These patients would otherwise be classified “unfeedable” as they would have no means to obtain the nutrients their body needs1.

The body undergoes immense stress during critical illness which can lead to multiple organ dysfunction, longer hospital stays, and a disproportionate death rate2. Coupled with the increased caloric deficit that arises when no nutrition is available, trials have shown that these complications are significantly worsened for patients who do not receive nutritional support3. They bring metabolic balance back to the patient as each component is personalized for the individual. Maintaining this proper nutrition in critically ill patients reduces the body’s response to stress, prevents cellular injury, and helps balance the immune response, all of which leads to better health outcomes2.

However the calculation of TPNs is complicated.

TPNs comprise not only the variety of proteins, carbohydrates, lipids, and electrolytes the body needs to function properly. They can also be further personalized by adding multivitamins, trace elements, and medications, such as insulin and those needed to prevent stress ulcers.

The “Moving Parts” of TPN Calculation

But it’s the many moving parts in the equation that make parenteral nutrition calculation even more complicated.

Multiple patient factors influence the final mix of ingredients that go into the “TPN order”: The form the healthcare professional fills out to specify what the patient needs based on their status.

Any Change Has Multiple Downstream Effects

Any small change in the patient’s status will alter the final make-up of their TPN order. Any small change in the products used for TPNs can mean a change in ratio of the required nutrients. This impacts the required quantity needed and subsequently the downstream calculations.

For example, electrolyte balances need to be checked to ensure that the proper acid-base balance is achieved. Osmolarity also needs to be checked to determine which IV route can be safely used for administration. It is also important to not overfeed the patient. Many of the patients who receive TPNs are malnourished and overfeeding can increase stress on vital organs and cause serious health problems1.

TPN calculations are a balancing act between getting the patient what they need and not overloading them. Precise monitoring is required to make daily changes to the TPN, adjusting to the changing lab values4.

How KNIME Simplifies TPN Calculations

With so many variables affecting TPN calculation, there is considerable potential for error. Automating TPN calculations increases efficiency and minimizes error. However, due to the changing nature of a patient's dietary requirements, available products etc., automating these calculations using standard IT-driven approaches is challenging. Conventional tools might not be flexible enough for such a customized solution. In addition, the important concepts of TPN calculation have to be explained to the IT team – to non-healthcare specialists – in order for them to be able to provide an automated solution.

This process can be made more efficient when the healthcare specialists are able to build their own automated solution.

5 Weeks from Project Start to Finish: TPN Calculator in KNIME

During the final part of my Advanced Pharmacy Practice Elective (APPE) rotation, I used KNIME to build an automated solution. As a no-code/low-code data science tool, it gave me – as a healthcare specialist with no coding background – ease of learning and access to advanced analytics.

The final product of this rotation uses KNIME Analytics Platform for each aspect of the calculation and creates an interactive dashboard – all without a single line of code. In combination with a KNIME Server, this dashboard can be shared or made centrally available as a browser-based data app.

Have a look at the result.

automating-tpn-calculation.png
Figure 1: The TPN calculator dashboard and the underlying workflow

Doing the calculations by hand can be quite complicated in order to ensure everything is balanced. By using the TPN calculator workflow, the patient and product data can be entered and the final TPN order calculated in just a few seconds.

The interactivity of the calculator also allows users to quickly see how changing a part of the order will affect the final product. It also alerts the pharmacist to when ratios go over or below thresholds. This solution could be advanced further in KNIME by automating patient data loading for a central hospital database.

At the School of Pharmacy at VCU, we see the project as a proof of concept that demonstrates how someone who is educated in a healthcare field and understands TPNs but knows very little about coding, can really quickly implement a workflow of relevance to healthcare practice.

Within the span of a five week Advanced Pharmacy Practice Elective (APPE) rotation, someone with no knowledge of KNIME or coding has successfully managed to create a tool to simplify TPN calculations.

Tip: Download the TPN Calculator workflow to use yourself and watch a presentation of how it's used in the video below.

Watch a presentation by Courtney Ciarrocca where she addresses the challenges of Total Parenteral Nutrition Calculation. She shows how these challenges are met with the TPN Calculator, demonstrates how it can be used based on a patient case, and provides a walkthrough of the workflow behind the TPN Calculator data app.