Update techreview

This commit is contained in:
Danila Fedorin 2019-11-08 23:22:07 -08:00
parent a6124db2bd
commit 8f74990a79

View File

@ -53,30 +53,30 @@ the settings of the wireless collar devices. This
section describes the components of this application.
\subsubsection{Platform}
The Android paltform makes up more than half of the market share
in the United States, with a majority of the remaining share taken
The Android platform makes up more than half of the market share
in the United States \cite{android-share}, with a majority of the remaining share taken
up by Apple iOS. Because iOS requires an Apple device to perform
development [citation needed], and because Android devices are
on average more 50\% cheaper than iPhone devices, we will
development, and because Android devices are
on average more than 50\% cheaper than iPhone devices \cite{iphone-price}, we will
use the Android platform for developing the mobile application
associated with this project.
% Source https://www.businessinsider.com/android-stops-us-market-share-decline-2013-5
% https://www.businessinsider.com/android-stops-us-market-share-decline-2013-5
% https://www.forbes.com/sites/amitchowdhry/2015/02/03/average-iphone-price-increases-to-687-and-android-decreases-to-254-says-report/#4d9d29a3539e
\subsubsection{Language}
There exists a variety of available technolgoies and techniques suitable
There exists a variety of available technologies and techniques suitable
for creating an Android application. The most common way for developing
Android apps is using the Java programming language,
utilizing the standard Android tooling. Such tooling includes
the Android Studio Integrated Development Environment (IDE),
and the Gradle build system. However, since Android's creation,
multiple other ways of developing Android applications have been introduced. For
example, technologies such as the Ionic Framework and
React Native have been created, allowing for the creation
example, technologies such as the Ionic Framework \cite{ionic} and
React Native \cite{react-native} have been created, allowing for the creation
of Android applications using the JavaScript programming
language. More recently, Google announced that JetBrains' Kotlin
language will be made an official language of the Android
platform.
platform \cite{android-kotlin}.
%https://ionicframework.com/
%https://facebook.github.io/react-native/
%https://www.theverge.com/2017/5/17/15654988/google-jet-brains-kotlin-programming-language-android-development-io-2017
@ -122,17 +122,26 @@ The data collected will consist of GPS coordinates of the animal,
taken every 15 seconds, as well as instances of the activation
of the collars' sound and shock features. This way, the client
can monitor the locations and habits of the animals, as well
as quantatively assess the number of items that the animals
as quantitatively assess the number of items that the animals
attempt to leave the prescribed area. Each data point will
be associated with the collar that produced it, such that
behaviors of individual animals can be easily analyzed.
\subsubsection{Storage Type}
An SQL database will be used for storing the data generated
by the collars. A single MariaDB server will be used to store
the data. MariaDB was chosen because of its permissive license
and compatibility with MySQL, another SQL dialect that is very
commonly used in the industry.
by the collars. The technology chosen for this is MariaDB.
MariaDB \cite{mariadb} was chosen because of its permissive license
and compatibility with MySQL \cite{mysql}, another SQL dialect that is very
commonly used in the industry. There exist other technologies
for storage, such as MongoDB, which do not use the relational
model used by SQL-based databases. The advantage of NoSQL databases
is the ability to store data in arbitrary formats, without
specifying prior schema. On the other hand, SQL-based
systems (including MySQL and MariaDB) support concurrency,
which is much more useful for our project due to the future
need to scale the fenceless grazing system. Additionally,
we already know the format of our data, making the benefit
of flexible data storage irrelevant to our use case.
% https://mariadb.org/
% https://www.mysql.com/
@ -145,12 +154,25 @@ computer. This computer not only has a full-featured
Debian Linux operating system, but also allows for the
addition of hardware components, which will be used
for communicating with collars in the field. Among the
hardware components compatible with the Raspberry Pi is a
hardware components compatible with the Raspberry Pi \cite{raspi} is a
LoRa shield, which allows the Pi to send and receive
LoRa signals. This is ideal since the server machine will also act as the LoRa
gateway, serving as the liaison between the collars
deployed in the field and the rest of the project.
Alternative implementations include an AVR-based microcontroller
equipped with ethernet and / or Bluetooth. Such a controller
would be integrated with a LoRa receiver and transmitter,
and programmed to send data to some other storage medium,
potentially a Virtual Private Server (VPS). This
implementation was dismissed due to the additional
complexity introduced by separating the LoRa receiver
and transmitter from the storage medium. This leaves
room for issues such as network errors between
LoRa and the SQL machine, which are entirely
avoided my using a Linux machine (Raspberry Pi) with support
for external hardware components (LoRa shield).
% https://www.raspberrypi.org/
\subsection{App API Server}
@ -167,13 +189,21 @@ The server will run on the aforementioned Linux machine.
This is because it is rather expensive, in terms of both
price and complexity, to introduce two server machines
for the individual tasks of SQL data storage and smartphone
app support. The server will use the Python programming
language, which is natively supportd by the Raspberry Pi,
to host an HTTP(s) server on the local network. The
use of Python will allow for rapid development, as give
direct access to the server's LoRa hardware.
app support.
The Gunicorn server will be used to expose the Python
The server will use the Python \cite{python} programming
language, which is natively supported by the Raspberry Pi,
to host an HTTP(S) server on the local network. The
use of Python will allow for rapid development, and give
direct access to the server's LoRa hardware. While other
languages, such as Go, are also commonly used for API
implementations, they lack the first-class support that
Python receives from the Raspberry Pi project. Additionally,
Python is currently at the top of the popularity rankings
for programming languages, leading to increased access
to documentation and support.
The Gunicorn \cite{gunicorn} server will be used to expose the Python
application to the Android application clients. While
other web servers, such as Apache and nginx, are very
commonly deployed in production, Gunicorn has excellent
@ -186,7 +216,7 @@ quickly develop the HTTP application.
\subsubsection{Authentication}
The mobile app will use JSON web token (JWT)
to allow the mobile application to make multiple requests
without having to continously provide a username
without having to continuously provide a username
and password to the server. The idea of JWT is that
a JSON (JavaScript Object Notation) object, containing
session information (such as the identity of the current user),
@ -195,17 +225,29 @@ version of this object is then sent to the user, and can be
used as a "proof of identity". Since only the server can decrypt
the token, the user cannot deliberately make changes to it, preventing
security breaches. Once a user logs in, a JWT token will be generated,
containing the identity of the user and an experiation date, and
containing the identity of the user and an expiration date, and
returned to the app. The app will then use the token for further
requests.
Cookie-based authentication systems were considered as an alternative;
This is commonly used in web applications, serving as a different
way to avoid authentication on every API or web request. However,
this approach will not generalize well. Using cookie or session-based
authentication requires more extensive bookkeeping on the client side, which
complicates the implementation of other clients. In the future, it is
likely that the smart application will be ported to other platforms,
including iOS and Web. To ease this expansion, the approach
requiring the least additional implementation overhead is preferred.
Because of this criterion, JWT-based authentication is better suited
for the API server.
\subsubsection{API}
There are several ways of communicating data to the mobile application
from the server. Because writing custom code to encode / decode data
send between the android application (client) and the server is
time consuming and prone to errors, priority is given to existing
encoding / decoding technologies. Of these technologies, Google's
ProtoBuf, XML, and JSON are the most viable. JSON was chosen
ProtoBuf \cite{protobuf}, XML, and JSON are the most viable. JSON was chosen
for this project because of the ease with which it can be decoded,
as well as due to its compatibility with the JavaScript ecosystem.
Virtually every language (including Kotlin and Python) has support
@ -220,4 +262,41 @@ through HTTP containing the resulting data.
% https://developers.google.com/protocol-buffers
\pagebreak
\begin{thebibliography}{99}
\bibitem{android-share}Alex Cocotas, \textit{Android Bounces Back From U.S. Market Share Decline} \\
\texttt{https://www.businessinsider.com/android-stops-us-market-share-decline-2013-5}
\bibitem{iphone-price}Amit Chowdhry, \textit{Average iPhone Price Increases To $687 And Android Decreases To $254, Says Report} \\
\texttt{https://www.forbes.com/sites/amitchowdhry/2015/02/03/average-iphone-price-increases-to-687-and-android-decreases-to-254-says-report/\#437c18ac539e}
\bibitem{ionic}\textit{Ionic Framework} \\
\texttt{https://ionicframework.com/}
\bibitem{react-native}\textit{React Native} \\
\texttt{https://facebook.github.io/react-native/}
\bibitem{android-kotlin}Paul Miller, \textit{Google is adding Kotlin as an official programming language for Android development} \\
\texttt{https://www.theverge.com/2017/5/17/15654988/google-jet-brains-kotlin-programming-language-android-development-io-2017}
\bibitem{mariadb}\textit{MariaDB} \\
\texttt{https://mariadb.org/}
\bibitem{mysql}\textit{MySQL} \\
\texttt{https://www.mysql.com/}
\bibitem{raspi}\textit{Raspberry Pi} \\
\texttt{https://www.raspberrypi.org/}
\bibitem{python}\textit{Python} \\
\texttt{https://www.python.org/}
\bibitem{gunicorn}\textit{GUnicorn} \\
\texttt{https://gunicorn.org/}
\bibitem{protobuf}\textit{Protocol Buffer} \\
\texttt{https://developers.google.com/protocol-buffers}
\end{thebibliography}
\end{document}