<commit_before>\documentclass{scrartcl}

\usepackage{multirow}

\usepackage{listings}
\lstset{basicstyle=\footnotesize\ttfamily}

\usepackage{tikz}
\usepackage{pgf-umlsd}

\usepgflibrary{arrows} % for pgf-umlsd

\title{MUSTE server protocol}
\author{<NAME>}
\date{Document version 0.0.1}
\begin{document}
\maketitle

\section{Design principles}

\begin{itemize}
\item stateful - authentication happens once
\item unidirectional - client sends request, server answers
\end{itemize}

\section{Message format}

\begin{itemize}
\item Client messages (CM) are messages from the client sent to the server

  \begin{tabular}{llp{0.6\textwidth}}
    Message Name                      & Valid Responses   & Description \\
    \hline
    \multirow{2}{*}{CMLoginRequest}   & SMLoginSuccessful & \multirow{2}{*}{Send login request} \\
                                      & SMLoginFailed \\
    \hline
    \multirow{2}{*}{CMMOTDRequest}    & SMMOTDResponse    & \multirow{2}{0.6\textwidth}{Request a Message-of-the-day, e.g. the user survey from the server} \\
                                      & SMSessionInvalid \\
    \hline
    \multirow{3}{*}{CMDataResponse}   & SMDataReceived    & \multirow{3}{*}{Send result of the survey} \\
                                      & SMDataInvalid \\
                                      & SMSessionInvalid \\
    \hline
    \multirow{2}{*}{CMLessonsRequest} & SMLessonsList     & \multirow{2}{*}{Request available lessons} \\
                                      & SMSessionInvalid \\
    \hline
    \multirow{3}{*}{CMMenuRequest}    & SMMenuList        & \multirow{3}{*}{Send request for menus} \\
                                      & SMLessonInvalid \\
                                      & SMSessionInvalid \\
  \hline
\end{tabular}

\item Server messages (SM) are messages from the servert sent to a client

  \begin{tabular}{ll}
    Message Name      & Description \\
    \hline
    SMLoginSuccessful & Login successful \\
    SMLoginFailed     & Login failed \\
    SMMOTDResponse    & A potential html-fragment for a message of the day \\
    SMSessionInvalid  & Invalid Session \\
    SMLessonsList     & Lesson listing \\
    SMLessonInvalid   & Invalid lesson \\
    SMDataReceived    & Data received \\
    SMDataInvalid     & Invalid data
  \end{tabular}

\end{itemize}

\end{tabular}
\section{Sequences}
Login error:
\begin{sequencediagram}
  \newthread{server}{Ajax-Server}{Server}

  \newthread{client}{Web-Client}{Client}
  
  \begin{call}{client}{\shortstack{CM001\\username\\password}}{server}{SM002}
  \end{call}

\end{sequencediagram}

\end{document}<commit_msg>datatypes for these messages so far<commit_after>\documentclass{scrartcl}

\usepackage{multirow}

\usepackage{listings}
\lstset{basicstyle=\footnotesize\ttfamily}

\usepackage{tikz}
\usepackage{pgf-umlsd}

\usepgflibrary{arrows} % for pgf-umlsd

\title{MUSTE server protocol}
\author{<NAME>}
\date{Document version 0.0.1}
\begin{document}
\maketitle

\section{Design principles}

\begin{itemize}
\item stateful - authentication happens once
\item unidirectional - client sends request, server answers
\end{itemize}

\section{Message format}

\begin{itemize}
\item Client messages (CM) are messages from the client sent to the server

  \begin{tabular}{llp{0.6\textwidth}}
    Message Name                      & Valid Responses   & Description \\
    \hline
    \multirow{2}{*}{CMLoginRequest}   & SMLoginSuccessful & \multirow{2}{*}{Send login request} \\
                                      & SMLoginFailed \\
    \hline
    \multirow{2}{*}{CMMOTDRequest}    & SMMOTDResponse    & \multirow{2}{0.6\textwidth}{Request a Message-of-the-day, e.g. the user survey from the server} \\
                                      & SMSessionInvalid \\
    \hline
    \multirow{3}{*}{CMDataResponse}   & SMDataReceived    & \multirow{3}{*}{Send result of the survey} \\
                                      & SMDataInvalid \\
                                      & SMSessionInvalid \\
    \hline
    \multirow{2}{*}{CMLessonsRequest} & SMLessonsList     & \multirow{2}{*}{Request available lessons} \\
                                      & SMSessionInvalid \\
    \hline
    \multirow{3}{*}{CMMenuRequest}    & SMMenuList        & \multirow{3}{*}{Send request for menus} \\
                                      & SMLessonInvalid \\
                                      & SMSessionInvalid \\
  \hline
\end{tabular}

\item Server messages (SM) are messages from the servert sent to a client

  \begin{tabular}{ll}
    Message Name      & Description \\
    \hline
    SMLoginSuccessful & Login successful \\
    SMLoginFailed     & Login failed \\
    SMMOTDResponse    & A potential html-fragment for a message of the day \\
    SMSessionInvalid  & Invalid Session \\
    SMLessonsList     & Lesson listing \\
    SMLessonInvalid   & Invalid lesson \\
    SMDataReceived    & Data received \\
    SMDataInvalid     & Invalid data
  \end{tabular}

\end{itemize}

\section{Message Datatypes}

General format:
\begin{lstlisting}
  {"message":string, "parameters":object}
\end{lstlisting}
With \texttt{message} field containing the message name and \texttt{parameters} containing (optional) message parameters.

\begin{tabular}{lll}
  Message & Parameters \\
  CMLoginRequest &
  \begin{lstlisting}
    {"username":string,"password":string}
  \end{lstlisting} \\
  CMMOTDRequest &
  \begin{lstlisting}
    {"token":string}
  \end{lstlisting} \\
  CMDataResponse &
  \begin{lstlisting}
    {"token":string,"context":string,"data":["field":string,"value":string]}
  \end{lstlisting} & {\bfseries\footnotesize 1} \\
  CMLessonsRequest &
  \begin{lstlisting}
    {"token":string}
  \end{lstlisting} \\
  CMMenuRequest &
  \begin{lstlisting}
    {"token":string,"score":number,
      "a":{"tree":string,"grammar":string},
      "b":{"tree":string,"grammar":string}
    }
  \end{lstlisting} \\
  SMLoginSuccessful &
  \begin{lstlisting}
    string
  \end{lstlisting} & {\bfseries\footnotesize 2} \\
  SMLoginFailed &
  \begin{lstlisting}
    null
  \end{lstlisting} \\
  SMMOTDResponse &
  \begin{lstlisting}
    string
  \end{lstlisting} & {\bfseries\footnotesize 3} \\
  SMSessionInvalid &
  \begin{lstlisting}
    string
  \end{lstlisting} & {\bfseries\footnotesize 4} \\
  SMLessonsList &
  \begin{lstlisting}
    [{"name":string,"passed":boolean}]
  \end{lstlisting} \\
  SMLessonInvalid &
  \begin{lstlisting}
    null
  \end{lstlisting} \\
  SMDataReceived &
  \begin{lstlisting}
    null
  \end{lstlisting} \\
  SMDataInvalid &
  \begin{lstlisting}
    string
  \end{lstlisting} & {\bfseries\footnotesize 5} \\
\end{tabular}

\begin{description}
\item[{\footnotesize 1}] \texttt{token} is an identifier assigned to the client session by the server. \texttt{value} can either be a number between 1 and 5 for fields with Likert scale and a string for the freeform fields
\item[{\footnotesize 2}] String representing the token to be used by all following client requests
\item[{\footnotesize 3}] a html fragment to be displayed as a message of the day
\item[{\footnotesize 4}] String indicating indicating reason like timeout or not authenticated
\item[{\footnotesize 5}] String for a potential error message
\end{description}
%% [{ name : string, passed : bool }]
\section{Sequences}
Login error:
\begin{sequencediagram}
  \newthread{server}{Ajax-Server}{Server}

  \newthread{client}{Web-Client}{Client}
  
  \begin{call}{client}{\shortstack{CM001\\username\\password}}{server}{SM002}
  \end{call}

\end{sequencediagram}

\end{document}
{'fraction_non_alphanumeric': 0.1251324152542373, 'fraction_numerical': 0.007680084745762712, 'mean_word_length': 2.668285575522098, 'pattern_counts': {'":': 21, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '107787', 'n_tokens_mistral': 2384, 'n_tokens_neox': 2317, 'n_words': 515}