## 3 Materials and Methods
### Methods
#### 3.2.2 Pathway Prediction  
SNS24 calls are received by nurses that, after an initial assessment (pre-triage) that enables the detection of emergent situations, follow predefined clinical pathways. The outcome of a pathway is a referral (transference to PIC, transference to INEM, clinical assessment in hospital emergency or at a primary health care unit and self-care) that can be changed by the nurse. Self reported symptoms and signs, as well as relevant information provided on medical history are considered for the selection of the most appropriate clinical pathway. This choice is extremely relevant since it should have the discriminant capability for not sending to Hospitals Emergency situations of low clinical risk and, most importantly, ensure safety by identifying all situations that demand urgent medical contact. Since, in the course of a call, nurses need to choose a specific clinical pathway, this problem can be seen as a multi-class classification task where the \"Clinical pathway\" is the class to be predicted. The \"Contact Reason\" text was processed to get 2 different representations aiming to weight the importance of a word in the prediction task: the traditional TF-IDF representation (which determines the importance of a word in the text within the corpus) and a locally trained word embedding (word embeddings map the words into a low-dimensional continuous space encoding their semantic and syntactic information by assuming that words in similar contexts should have similar meanings [23]). \begin{table}
\begin{tabular}{l l} \hline \hline
**Contact Reason** & **Clinical Pathway** \\ \hline _desde dia 21 tosese seca provoca o vomito, mialgias_ & Flu syndrome \\ since the 21 st dry cough causes vomiting, mylgias & \\ \hline _Sangue nas fezes e diarreia ha 5 h_ & Diarrhea \\ Blood in stool and diarrhea for 5 h & \\ \hline _Lombalgis e hematuria hd 72 h_ & Urinary problem \\ Low back pain and hematuria 72 h ago. & Body temp. change pr. \\ \hline _Episodios de febre e extremidades cianosadas hd 18 h_ & \\ Episodes of fever and cyanotic extremities for 18 h & \\ \hline _Dor nu regido costal algumas vezes_ & Chest pain \\ Pain in the rib area sometimes & \\ \hline \hline \end{tabular}
\end{table} 
Table 1: _Cont._The ML algorithms chosen to build the prediction models were SVM and CNN. This selection was made considering the previous work developed over a 3 month data period. In [2] Random Forests, SVM with linear and RBF kernels SVM and Multinomial Naive Bayes were tested with different text representations (TF-IDF with different n-grams and BERT [24] and Flair [25] embeddings); linear SVM with Flair embedding model reached the highest performance. In [3], a comparison between several DNN architectures (CNN, RNN and Transformers, namely BERTimbau Base BERT model for Portuguese [26], based architectures) was made using locally trained word embeddings with a 200-dimension vector; the transformers based architecture reached the best performance. The RBF kernel SVM algorithm and the CNN based architecture were chosen for this work because they presented the best compromise between model performance and the time needed to build the models. Following the setup from previous experiments, a SVM with standard RBF kernel with default parameters using TF-IDF to represent text [2] and a CNN based architecture with locally trained word embeddings [3] were used. The CNN architecture used was a classical convolutional neural network for text classification described by [PERSON] [27] and was composed of 4 hidden layers: convolutional, max-pooling, fully connected and dropout layers. The convolution layer's settings were as follows: filters = 128, kernel_size = 3, activation ='relu'; the dense layer's settings were as follows: batch_size = 128, activation ='relu'; the settings of the dropout layer [28] were as follows: dropout_rate = 0.3; and finally, the ADAM optimizer [29] was selected with patience = 5 and learning_rate = 10\({}^{-4}\).