## 2 Materials and Methods
### Data Processing  
This subsection describes how we processed and combined the fitness tracker dataset and the wearing-off dataset. First, the sleep dataset was aggregated according to each calendar date and the sleep classification, as listed in Table 1. The original sleep data (Table 4) were transformed into aggregated sleep data (Table 5). Furthermore, additional sleep features were calculated. Figure 2: The customized FonLog smartphone application. (**a**) The home screen shows each questionnaire: WoQ-9 step 1 for symptoms onset, WoQ-9 step 2 for drug intake time, basic information, H&Y, and PDQ-8, as discussed in Section 2.1.3. (**b**) A sample FonLog form presents the WoQ-9 step 1, asking if each symptom described in Section 2.1.5 has been experienced. The total non-REM sleep duration was the sum of deep and light sleep duration (Equation (1)). Next, the total sleep duration was the sum of total non-REM sleep duration and REM sleep duration (Equation (2)). Then, the percentage of non-REM sleep was the ratio of the non-REM sleep duration to the total sleep duration (Equation (3)) [35]. Finally, we estimated the sleep efficiency as the ratio of the total sleep duration to the sum of the total sleep and total waking duration (Equation (3)) [36]. Total non-REM duration \[=\text{Deep sleep duration}+\text{Light sleep duration}\] (1)  
Total sleep duration \[=\text{Total non-REM duration}+\text{REM sleep duration}\] (2)  
Total non-REM percentage \[=\frac{\text{Total non-REM duration}}{\text{Total sleep duration}}\] (3)  
\[\text{Sleep efficiency}=\frac{\text{Total sleep duration}}{\text{Total sleep duration}+\text{Total awake duration}} \tag{4}\]  
Second, the missing values were filled with \"\(-1\)\" before re-sampling. This was in accordance with how Garmin Health API reported stress scores when they could not estimate the stress level [28]. Replacing missing values with \"\(-1\)\" would also indicate that the participant was not wearing the fitness tracker. Third, the fitness tracker datasets were re-sampled due to their varying granularity. We chose 15 s and 15 min intervals to represent the minimum and maximum granularity in the fitness tracker datasets, respectively. The resulting missing values due to re-sampling were filled by copying the last available data. This was the chosen fill method to replicate the streaming behavior of the fitness tracker dataset, as the future values would not be available. Finally, the wearing-off dataset was cleaned by removing overlapping wearing-off data. Then, the wearing-off and the drug intake datasets were combined with the fitness tracker dataset. Each record was checked if it fell within the timestamp. If so, a value of \"1\" was assigned for the \"y\" or wearing-off variable; otherwise, a value of \"0\" was set. Similarly, if each drug intake record fell within the timestamp, the time that elapsed from the start of each drug intake record was computed. The time that elapsed for the succeeding drug intake record was set back to \"0\". The raw available datasets from Garmin and the FonLog smartphone application and the combined dataset are provided in the Supplementary Materials. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Calendar Date** & **Start Time** & **End Time** & **Sleep Type** \\ \hline
2021-02-23 & 2021-02-23 02:24:00 & 2021-02-23 02:32:00 & Light \\
2021-02-23 & 2021-02-23 02:32:00 & 2021-02-23 02:33:00 & Awake \\
2021-02-23 & 2021-02-23 02:33:00 & 2021-02-23 02:36:00 & Light \\ \hline \hline \end{tabular}
\end{table} 
Table 4: The original sleep dataset provided by Garmin Health API. Each row shows the start and end time of each sleep stage.