## 3 The Recommendation Pipeline
### Relevant Patient Set Construction  
DataToCare constructs a set of relevant patients \(\mathbb{P}(\mathcal{S}[\widehat{p}])\) to the target patient \(\widehat{p}\) in state \(\mathcal{S}[\widehat{p}]\) by ranking patients based on _degree of similarity_, \(d\). If \(L_{p}\) is the set of measurements with low abnormal values, and \(H_{p}\) is the set of measurements with high abnormal values, then the degree of similarity between the target patient \(\widehat{p}\) and any patient \(p\) is  
\[\frac{|L_{p}\cap L_{\widehat{p}}|+|H_{p}\cap H_{\widehat{p}}|}{|L_{\widehat{p }}\cup H_{\widehat{p}}|}\]  
In our model, two patients can be considered similar even if timings do not match. For example, the GANNT chart of Figure 2 shows a case in which a target patient \(\widehat{p}\) has abnormally high blood pressure and abnormally low oxygen saturation and normal body temperature. That target patient is very similar to a patient \(p_{1}\) who has high blood pressure and low oxygen saturation. Quantitatively, the degree of similarity is:  
\[\frac{|\{\text{low }O2\}|+|\{\text{high }\text{bp}\}|}{|\{\text{high }\text{bp},\text{low }O2\}|}=\frac{2}{2}\] \begin{table}
\begin{tabular}{l l} \hline \hline
**Cleaning and Standardization Step** & **Example** \\ \hline Original entry & Furosemide (Lasix) 500/100\% \\ Convert to lower case & furosemide (lasix) 500/100\% \\ Exclude digits & furosemide (lasix) /\% \\ Exclude units & furosemide (lasix) \\ Exclude brand name & furosemide \\ Match to generic name & furosemide \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Example illustrating the data cleaning steps to extract the generic drug names (last line, furosemide in this case) from raw medication orders (first line). even though the time durations and start times do not match. Another patient \(p_{2}\) with high blood pressure and high body temperature has a degree of similarity of  
\[\frac{|\{\}|+|\{\text{high bp}\}|}{|\{\text{high bp},\text{low O2}\}|}=\frac{1}{2}\]  
to the target patient \(\lx@overaccentset{{\text{*}}}{p}\). Orthogonal to the similarity measure, the identification of relevant patients depends on which abnorms are associated with a patient in state \(s\). In an _instantaneous_ evaluation of abnorms, for each potentially similar patient, we find the abnorms that hold at each state, disregarding history. For example, in Figure 3, at time 12, the patient has a low abnormal value of neutrophils. By contrast, at time 18, the patient has a high abnormal value, so the instantaneous value of neutrophils at time 18 is high. In an _accumulated_ evaluation of abnorms, a measurement \(m\) is high-abnormal (respectively, low-abnormal) for a patient \(p\) if it was high-abnormal (respectively, low-abnormal)  
Figure 3: Variation of measurement states in a potential similar patient and the corresponding accumulated and instantaneous subsets of abnorms at hour 30. Figure 2: Measurement timeline and resulting example of similarity scores. _Upper panel:_ timelines for the target patient and two candidate similar patients over a 9–17 h window. Each colored bar denotes an abnormal measurement episode: red = _high abnormal_, blue = _low abnormal_, grey = _normal_. _Lower panel:_ degree of similarity \(d\) to the target patient. Similar Patient 1 shares both high bp and low O2, yielding \(d=1\); similar Patient 2 matches only high bp, so \(d=0.5\). at any time during the ICU stay of \(p\). For example, the same patient as in Figure 3 would have both low and high abnormal measurements for neutrophils. In a slightly extended example, consider a situation in which patient \(p\) has a high temperature, a high white blood cell (WBC) count, and low blood pressure on day 2 and then a low temperature, low WBC count, and high blood pressure on day 5.