% Final: Contacts Project
%
% CSE/IT 107: Introduction to Programming
% New Mexico Tech
%
% Prepared by Marci McBride, and Roguh
% Spring 2016
\documentclass[11pt]{cselabheader}

% Define title and author
\newcommand{\thelabnumber}{final}
\newcommand{\thetitle}{Final Project: Contacts}
\newcommand{\theauthor}{CSE/IT 107L}

% Write title and author
\title{\thetitle}
\author{\theauthor}
\date{NMT Department of Computer Science and Engineering}

\fancyhead[R]{Lab \thelabnumber: \thetitle}
\fancyhead[L]{\theauthor}

\makehyperref
\makeindex[title=Index of New Functions and Methods, intoc]

\begin{document}

\pagenumbering{roman}
\maketitle
\hrule

\begin{figure}[H]
\centering
\includegraphics[width=0.5\textwidth]{img/xkcd_good_code.png}
\caption{XKCD on how to write good code \url{https://xkcd.com/844/}.}
\end{figure}

\hrule

\pagebreak

\setcounter{tocdepth}{2}
\tableofcontents

\section*{Grading}
\begin{description}
\item[60\%] Code Implementation
\item[10\%] Design
\item[10\%] Readme
\item[10\%] Docstring Comments
\item[05\%] Code follows PEP 8 and PEP 257 style guides
\item[05\%] Tarball is named correctly. i.e. \texttt{cse107\_firstname\_lastname\_contacts.tar.gz}
\end{description}

\begin{center}
\begin{figure}[H]
\includegraphics[width=0.8\textwidth]{img/xkcd_spinal_tap_amps.png}
\caption{XKCD on engineers \url{https://xkcd.com/670/}.}
\end{figure}
\end{center}

\pagebreak
\pagenumbering{arabic}

\section{The Problem}

You are an employee of NMTLabs, a small software consultation firm for
noble gas mass spectrometry. At this week's developer meeting
you were tasked with developing an application to manage the firm's
contacts. The CEO and CTO of NMTLabs are looking for something that is
text-based and easy to use, so the firm can quickly start calling
contacts for the latest round of venture capital fundraising.
Heretofore the firm has been using a simple CSV file to save all of
its contacts.  Everyone in the organization is looking for an improved
solution and are counting on you to have a working prototype.

The CTO has specified a set of tasks your contacts application must
perform. Please examine the requirements carefully, implement as many
of the tasks as possible including the Extra Credit (E.C worth 1\%
each)

\subsection{Example Session}
An example session using the application is shown below. A user starts
the application, enters the commands, about, info, list and finally
exit.  The application displays a farewell message and quits.
Note line 1 is a terminal command.

\begin{verbatimcode}
$ python3 contacts.py
Welcome to the Contact application
Please enter a command: about
Contacts App. Developed by Jake Ross for CSE107 2015

Please enter a command: info
contacts path: contacts.txt
number contacts: 3

Please enter a command: list
Name       : Phone     Company email
-----------------------------------------------
Elon Musk  : 453-6723  SpaceX  emusk@spacex.com
Larry Page : 853-0653  Google  lpage@gmail.com
Tim Cook   : 133-0419  Apple   tcook@apple.com

Please enter a command: exit
Goodbye
\end{verbatimcode}%$

\section{Assignment}
Make your code clean and readable. You will be graded on style and
functionality.  \textbf{You must follow PEP8 and PEP257}.

\subsection{Design}
Provide a description of how you plan to solve this problem. Draw figures,
flowcharts, and tables with detailed annotations (notes). Consider and describe
typical use cases. For example,

\begin{enumerate}
\item The application starts.
\item The user wants to add a contact.
\item The program sequentially asks for required information validating each
inputted value.
\item The program adds contact to its stored contacts.
\item The added contact information is displayed to the user.
\end{enumerate}

\subsection{README}
Write a \texttt{README.txt} file. This is common practice in the open
source community and provides a consistent location for users to find
introductory information about your application. This file should
contain a brief description of what your code does and some
information on how to run it.  You should provide a list of valid
commands, their function, and examples of their use.

\subsection{Contacts Format}
A contact is something that stores least the following attributes:
\begin{itemize}
\item Name
\item Phone
\item Company
\item Email
\item Note
\end{itemize}

Here is a sample CSV file describing many contacts.

\begin{verbatimcode}
Name, Phone, Company, Email, Note
Elon Musk, 453-6723, SpaceX, emusk@spacex.com
Larry Page, 853-0653, Google, lpage@gmail.com
Tim Cook, 133-0419, Apple, tcook@apple.com
\end{verbatimcode}

\subsection{Application Commands}
\begin{itemize}
\item Get input from the user.
\item Think of and display a unique name for your application
\item Display a welcome message when the application starts.
\end{itemize}
To make testing easier, add some default contacts so you don't have to
constantly load a CSV file or manually enter contacts.

\subsubsection{The \texttt{exit} Command}
\begin{itemize}
\item Close the program.
\item Display a goodbye message when the application quits.
\end{itemize}

\subsubsection{The \texttt{about} Command}
\begin{itemize}
\item Print developer information. Developer name, date created, ... etc
\end{itemize}

\subsubsection{The \texttt{info} Command}
\begin{itemize}
\item Print number of contacts
\item Print number of companies
\item Print number of contacts per company
\end{itemize}

\subsubsection{The \texttt{list} Command}
\begin{itemize}
\item List all contacts.
\end{itemize}

\subsubsection{The \texttt{remove} Command}
\begin{itemize}
\item Report contacts updated
\item Warn user if trying to remove contact that does not exist
\end{itemize}

\subsubsection{The \texttt{note} Command}
\begin{itemize}
\item Allow user to edit a note associated with a specified contact
\item Allow user to see current note
\end{itemize}

\subsubsection{The \texttt{add} Command}
\begin{itemize}
\item Allow user to add a contact. There should be a prompt for each field of a
    contact.
\end{itemize}

\subsubsection{The \texttt{load} Command}
\begin{itemize}
\item Load a default contacts file when the application starts
\item Warn user if entered invalid file
\end{itemize}

\subsubsection{The \texttt{save} Command}
Use this command to write a line of a CSV file:
\begin{python3code}
savefile.write("{}, {}, {}, {}, {}\n".format(
    name, phone, company, email, note))
\end{python3code}

\subsubsection{The \texttt{commands} Command}
\begin{itemize}
\item Load a set of commands from a file and execute them. An example command file
might look like the following.
\end{itemize}

\begin{verbatimcode}
add joe
phone: 555-5555
add jane
phone: 555-5555
email: jane@jane.jane
remove bob
\end{verbatimcode}

\subsection{Extra Credit}
\begin{itemize}
\item Use a random welcome and goodbye message chosen from a set of available
    messages.
\item Verify CSV save path can be written to, i.e parent directory exits
\item Validate user input in add or edit commands. Verify phone, email correct
    formats. i.e.  (xxx)xxx-xxxx
\item Add the \texttt{lookup} Search for contacts by substring. Offer
    case-insensitive search.
\item Allow multiple notes for a given contact. User should be able to list, add,
    remove notes.
\item Stay in each mode before asking user for another command. For example if user
    wants to add a bunch of contacts, enter ’add’ mode, add contacts manual, and explicitly
    exit add mode with ’exit’
\item Group contacts. Add ability to manage groups of contacts. Contacts may exist in
    multiple groups. Add an additional command set for working with groups, i.e add,
    remove, list groups, list contacts in group etc.
\item Import contacts from a csv file
\item Export contacts to YAML, XML, JSON, etc...
\item Associate an image with each contact. Add a command to display the contact’s
    image.
\item Add user login. Each user has a distinct set of contacts that is automatically loaded
    when the user logs in.
\end{itemize}

\newpage
\section{Submitting}

You should submit your code as a tarball. It should contain all files used in
solving the problems presented in this lab.  If you want to include hand
drawings, scan and include as PDFs.  The submitted file should be named

\begin{center}
  \texttt{cse107\_firstname\_lastname\_contacts.tar.gz}
\end{center}

\begin{center}
  \textbf{Upload your tarball to Canvas.}
\end{center}

\end{document}
