%===============================================================================
% Zweck:    KTR-Präsentation-Vorlage
% Erstellt: 15.04.2013
% Update:   04.07.2016
% Autor:    M.G.
%===============================================================================

%\newcommand*{\footcite}[1]{\footnote{\autocite{#1}}}

\newcommand\ratio{169}
\documentclass[10pt,aspectratio=\ratio,
%draft,
%handout,
compress
]{beamer}

\newcommand\meta{../meta}
\input{\meta/config/commands}
\newcommand{\backupbegin}{
   \newcounter{finalframe}
   \setcounter{finalframe}{\value{framenumber}}
}
\newcommand{\backupend}{
   \setcounter{framenumber}{\value{finalframe}}
}

\def\signed #1{{\leavevmode\unskip\nobreak\hfil\penalty50\hskip2em
  \hbox{}\nobreak\hfil(#1)%
  \parfillskip=0pt \finalhyphendemerits=0 \endgraf}}

\newsavebox\mybox
\newenvironment{aquote}[1]
  {\savebox\mybox{#1}\begin{fancyquotes}}
  {\signed{\usebox\mybox}\end{fancyquotes}}


\input{\meta/config/hyphenation}

\setbeamertemplate{caption}[numbered]
%\numberwithin{figure}{section}


 %\bibliographystyle{plain}
 \bibliography{../ThesTeX/content/literature.bib}

\begin{document}
  %===============================================================================
  % Zum Kompilieren latexmk ausführen.
  %	Konfiguration in texmaker: Options -> Configure Texmaker -> Quick Build -> Select Latexmk + ViewPD
  %	Entsprechende Informationen in den config/metainfo verändern
  % Zur Auswahl der Sprache im folgenden Befehl
  % ngerman für deutsch eintragen, english für Englisch.
  %===============================================================================
\selectlanguage{english}
\ifnum\ratio<169
\frame{\titlepage}
\else
\frame[plain]{\titlepage}
\fi

%\AtBeginSection[]
%{
%  \frame<handout:0>
%  {
%    \frametitle{Outline}
%    \tableofcontents[currentsection,hideallsubsections]
%  }
%}

%\AtBeginSubsection[]
%{
%  \frame<handout:0>
%  {
%    \frametitle{Outline}
%    \tableofcontents[sectionstyle=show/hide,subsectionstyle=show/shaded/hide,subsubsectionstyle=hide]
%  }
%}

\AtBeginSubsubsection[]
{
  \frame<handout:0>
  {
    \frametitle{Outline}
    \tableofcontents[sectionstyle=show/hide,subsectionstyle=show/shaded/hide,subsubsectionstyle=show/shaded/hide]
  }
}

\newcommand<>{\highlighton}[1]{%
  \alt#2{\structure{#1}}{{#1}}
}

\newcommand{\icon}[1]{\pgfimage[height=1em]{#1}}

\section*{}
\phantomsection
\begin{frame}{Content}
\tableofcontents[hideallsubsections]
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%% Content starts here %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Solution approach}
  \frame
  {
    \tableofcontents[sectionstyle=show/hide,hideothersubsections]
  }
\subsection{Requirements}
\begin{frame}{Requirements}
\framesubtitle{Wait, what did I want to do again?}
\begin{itemize}
	\item Per-game importer (Web client, File loader, …)
	\item Analyzer modules (number crunching)
	\item Output \& Visualization (CSV, [Geo]JSON, KML, Graphs, …)
	\item Interface (Configuration)
		\begin{itemize}
		\item Expert users/researchers
		\item Staging/designing staff
		\end{itemize}
	\item Cross-game comparisons
	\item Integration of external data (questionnaire results)
\end{itemize}
\end{frame}

\subsection{Architecture}
%\begin{frame}{Experiment: Kibana}
%\image{.85\textwidth}{kibana}{Game trace in Kibana}{img:kibana}
%\end{frame}
\begin{frame}{Experiment: Kibana}
\image{.85\textwidth}{kibana2}{Game trace in Kibana}{img:kibana2}
\end{frame}
\begin{frame}{Experiment: Grafana}\hspace{.3\textwidth}a\\[-24pt]
\image{.85\textwidth}{grafana}{Side project: Weather station with Grafana}{img:grafana}
\end{frame}

\begin{frame}{Architecture scheme}
\image{\textwidth}{../../ThesTeX/images/map-reduce.pdf}{Data flows}{img:flow}
\end{frame}

\section{Implementation}

\subsection{Technologies}
\begin{frame}{Implementation}
	\begin{columns}
	\column{0.55\linewidth}
		Analysis
		\begin{itemize}
			\item Python (3.6)
			\item Standalone library/CLI tool
			\item Web based configuration/Runner/API (Flask, Celery)
		\end{itemize}
		Rendering
		\begin{itemize}
			\item Matplotlib, Numpy
			\begin{itemize}
				\item Graphs
			\end{itemize}
			\item Javascript
			\begin{itemize}
				\item Leaflet
				\item Web visualization: Maps, Tracks, …
			\end{itemize}
		\end{itemize}
		\pic{.5\textwidth}{matplotlib}
	\column{0.4\linewidth}
		\pic{.5\textwidth}{python}
		\pic{.4\textwidth}{flask}
		\pic{.4\textwidth}{leaflet}
	\end{columns}
\end{frame}

\subsection{Microservice Composition}
\begin{frame}{Microservice Composition}
\framesubtitle{Docker everything!}
	\begin{columns}
	\column{0.45\linewidth}
		\begin{itemize}
			\item Analysis framework: Celery
			\item User interface: Flask
			\item Result server: Nginx
			\item Connection Flask - Celery: Redis
			\item Public frontend: Traefik (external)
			\item Orchestration: Docker-Compose
		\end{itemize}
	\column{0.525\linewidth}
		\image{\textwidth}{../../ThesTeX/images/architecture}{Service structure}{img:microservices}
	\end{columns}
\end{frame}

\subsection{Classes}

\begin{frame}{Analysis}
\twofigures{0.5}{code/analyzer}{Analyzer interface}{code:anif}{code/mask-spatials}{Sample analyzer}{code:mask}{Analyzer stub and implementation}{fig:pyan}
\end{frame}

\begin{frame}{Result}
\image{\textwidth}{code/result}{Result class}{code:result}
\end{frame}

\begin{frame}{Render}
\twofigures{0.5}{code/render}{Render interface}{code:reif}{code/render-board}{Sample render}{code:rebo}{Render stub and implementation}{fig:pyre}
\end{frame}

\subsection{Configuration}
\begin{frame}{Configuration \& result}
\twofigures{0.5}{oeb-kml}{Analyzer configuration}{img:oebkml}{oeb-ge}{Result visualized}{img:oebge}{Example: Generate KML tracks (BioDiv2Go; Oberelsbach2016)}{fig:oeb2016}
\end{frame}

\section{Outlook: Evaluation}
%TODO


\begin{frame}{Evaluation}
\begin{itemize}
	\item Analyse other geogames
	\item Describe effort
	\item ?
	\item Profit
\end{itemize}
\end{frame}

\begin{frame}{Evaluation}
Clients
\begin{longtable}[H]{ccp{0.6\textwidth}}
Geogame & Log files & Notes \\
\hline
BioDiv2Go & $\approx430$ & SQLite database with JSON log entries, references to game config; import base case\\
GeoTicTacToe & $\approx13$ & CSV with pipes; no temporal data; events + tracks\\
\caption{Geogame client log data}
\label{tab:logs}
\end{longtable}

Servers
\begin{longtable}[H]{ccp{0.6\textwidth}}
Geogame & Log files & Notes \\
\hline
GeoTicTacToe & $\approx2$ & intermediate log format\\
GeoTTT & $\approx130$ & fragmented structure: incomplete or splitted?\\
Neocartographer & $\approx400$ & Partly broken GPX: missing description information; one GPX file per player\\
MissingLink & $\approx6$ & Partly broken GPX: missing spatial information; one GPX file per player\\
Equilibrium & $\approx40$ & GPX with missing end tag\\
\caption{Geogame servers log data}
\label{tab:logs}
\end{longtable}
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%% References          %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{}
\begin{frame}[allowframebreaks]{References}
 \def\newblock{\hskip .11em plus .33em minus .07em}
 \scriptsize
 \setbeamertemplate{bibliography item}[text]
 \printbibliography
 \normalsize
\end{frame}

\appendix
\backupbegin

\begin{frame}{Architecture}
\begin{itemize}
	\item Based on map-reduce
	\item Map: Analysis
	\begin{itemize}
		\item Iterate Log entries
		\item Feed log entry through analyzer queue
		\begin{itemize}
			\item Augment entries
			\item Filter entries
			\item Sequential order
		\end{itemize}
	\end{itemize}
	\item Reduce: Collect summaries from analyzers
	\begin{itemize}
		\item Post-processing, Comparison, …
		\item Rendering
	\end{itemize}
\end{itemize}
\end{frame}

\begin{frame}{Graphs}
	\begin{columns}
	\column{0.45\linewidth}
		\image{\textwidth}{simu-retries}{Experimentational rounds}{img:retries}
	\column{0.45\linewidth}
		\image{\textwidth}{speed}{Speed distribution}{img:speed}
	\end{columns}
\end{frame}
\begin{frame}{Graphs}
\image{.9\textwidth}{time-rel}{Time distribution}{img:time}
\end{frame}
\backupend

\end{document}
