Background
Try out here: https://www.marksescon.com/ecm-main.
Patients in the ICU often require multiple simultaneous infusions, making drug compatibility critical. Enhanced Compat Mode operates through a straightforward interface where users select medications from a predefined list. The algorithm evaluates these selections against a compatibility dataset and iteratively forms optimized groupings, ensuring no incompatibilities arise. Results are presented in an intuitive table, clearly showing which medications can be grouped together, with the goal of utilizing the fewest lumens possible. Powered by JavaScript and leveraging an external JSON compatibility database, the web app is fully expandable and can be updated dynamically to accommodate new medications or guidelines, making it a future-proof solution for evolving clinical needs.
Machinations
If you are not interested in the innerworkings of the algorithm, you can skip this part.
Algorithm
Input Collection: The user selects all the medications the patient is receiving, categorized dynamically into primary and secondary infusions based on metadata.
Behavior Selection: The user chooses between Stacked Mode and Separated Mode for secondary infusions:
Stacked Mode: Secondary infusions can share a lumen even if incompatible with each other, as long as they are compatible with the primary infusion.
Separated Mode: Secondary infusions are separated into different lumens if they are incompatible with each other.
Compatibility Evaluation: Using the compatibility dataset, the algorithm checks:
Primary Compatibility: Ensures all infusions in a group are compatible with the primary infusion.
Secondary Handling: In Stacked Mode, secondary infusions are only checked for compatibility with the primary. In Separated Mode, all infusions in the same group must be compatible with each other.
Strict Compatibility Mode (if enabled): If Strict Mode is active, only medications with well-established compatibility (highest evidence) are grouped, excluding conditional or uncertain pairings.
Grouping Process: The algorithm iterates through the selected medications to create groups:
Prioritizes grouping medications with the most compatibility.
Non-secondary infusions are limited to three per group.
Secondary infusions in Stacked Mode can exceed the three-per-lumen rule if compatible with the primary.
Output Generation: The algorithm generates optimized groupings, displaying each group with its assigned infusions. It minimizes the number of lumens used while respecting compatibility constraints.
Compatibility information was garnered from Lexicomp and Stabilis. Those combinations with confirmed compatibility are scored 2; those with conditional compatibility are scored 1; and all else (incompatible and untested) are scored 0.
JSON and Scalability
The JSON structure in Enhanced Compat Mode transforms raw compatibility datasheets into a dynamic and actionable format. Compatibility data, typically presented as rows and columns in datasheets, is converted into a nested JSON structure, effectively creating a matrix. Each medication becomes a key, with its compatibility with other medications stored as subkeys and corresponding values.
For example:
This format enables the algorithm to quickly evaluate compatibility relationships without manual lookups.
The metadata` section enhances scalability by providing additional context for each medication, such as its category (e.g., Sedatives, Secondaries) and aliases. This allows the app to dynamically group medications and display user-friendly names. Adding a new medication is as simple as including it in the `metadata` and `compatibility` sections, ensuring seamless integration into the UI and algorithm.
The separation of metadata and compatibility makes updates modular and efficient. New medications or changes to compatibility guidelines require only localized updates to the JSON file, without altering the core functionality of the app.
This scalability ensures that Enhanced Compat Mode remains adaptable to evolving clinical practices and datasets.
Philosophical Considerations
The Conditional Compatibility Dilemma
The original compatibility dataset, sourced from Lexicomp and Stabilis, included not only binary outcomes (compatible or incompatible) but also conditional compatibilities—pairings that might work under specific circumstances. I initially introduced a scoring system to account for these conditional interactions, assigning values of 0 (incompatible), 1 (conditionally compatible), and 2 (fully compatible). The algorithm prioritized groupings with the least contention, aiming for configurations that were both compatible and stable.
However, as I progressed, I realized this approach added unnecessary complexity. Clinicians prioritize clarity and actionable results over navigating gray areas. Conditional compatibility often depends on variables like drug concentration, infusion rate, or compounding agents, which are rarely captured in static datasets. Without this context, the scoring system risked creating false confidence and undermining the tool’s practicality. Additionally, the distinction between “conditionally compatible” and “fully compatible” rarely impacted real-world groupings.
This realization led to Strict Compatibility Mode, which focuses exclusively on well-established, evidence-based compatibility. By eliminating ambiguity, this mode simplifies decision-making and ensures the tool remains reliable, intuitive, and aligned with the needs of clinicians.
Secondaries: To Be or Not to Be…Treated as Continuous Infusions?
Secondary infusions, like intravenous piggybacks (IVPB), are typically intermittent rather than continuous, which changes compatibility dynamics. To accommodate this, the tool introduces Stacked and Separated modes:
Stacked Mode: Secondary infusions can share a lumen even if incompatible with each other, provided they are compatible with the primary infusion. This assumes secondaries won’t run simultaneously, allowing them to “break” the three-per-lumen rule. For example, magnesium sulfate and potassium phosphates, which are incompatible with each other but compatible with vasopressin, can share the same lumen if administered at different times.
Separated Mode: Secondary infusions expected to run simultaneously are grouped into separate lumens. This ensures incompatible secondaries are never mixed, prioritizing safety. For instance, a patient requiring multiple antibiotics and electrolytes administered at the same time would benefit from this mode.
These modes provide flexibility to reflect real-world practices while maintaining safety.
Shortcomings
While the tool offers significant benefits, limitations remain. It does not account for central venous access requirements or prioritize infusions based on clinical urgency. It also assumes all secondaries pair with a single primary (e.g., Normal Saline), without addressing scenarios involving multiple primaries. Additionally, it cannot enforce institution-specific policies, such as dedicated lumens for TPN or lipids. These limitations underscore the importance of clinical judgment in complex cases.
Future Synergy with DripMap
Enhanced Compat Mode is an offshoot of DripMap, a tool designed to visually map infusion setups. Future integration will combine compatibility optimization with visual mapping to create a comprehensive solution for IV management, dubbed FlowMatrix. Challenges like accounting for medication aliases (e.g., Levophed vs. Norepinephrine) highlight the importance of bridging technical precision with clinical usability. By addressing these gaps, the tool aims to offer clinicians an intuitive, end-to-end solution for managing complex infusion setups.
Conclusion
This project illustrates the delicate balance between technological innovation and practical clinical application. By evolving from a complex scoring system to a streamlined, evidence-based approach, Enhanced Compat Mode prioritizes clarity and usability, making it a valuable tool for optimizing IV management. While limitations remain, the lessons learned lay the foundation for future iterations, ensuring the tool continues to grow alongside the needs of clinicians and patients.