<commit_before>
\section{The \pkg{sbtools} package}
\begin{itemize}
	\item{Goal to allow programmatic access to core SB functionality}
	\item{Harmonize the SB data structures with common R interfaces}
	\item{Lightweight R package that can be quickly added to existing projects and shared broadly}
\end{itemize}

\subsection{Search API}
\begin{itemize}
	\item{Go over general search API}
	\item{Free text search}
	\item{dateRange query}
	\item{Spatial query}
	\item{Hierarchical SB queries (sub-items)}
	\item{Combination of above}
\end{itemize}

\subsection{Data access API}
\begin{itemize}
	\item{Basic item metadata access}
	\item{Attached file listing and downloading}
	\item{Accessing special SB extensions}
	\item{Hierarchy traversal}
\end{itemize}

\subsection{ScienceBase authenticated}
\begin{itemize}
	\item{How authentication changes SB}
	\item{Authentication in sbtools}
	\item{Authentication persistence and use throughout package}
	\item{Examples of authentication and other auth-related functions (check and such)}
\end{itemize}


\subsection{Data editing and upload API}
This will be an extensive section
\begin{itemize}
	\item{Item creation}
	\item{Item deletion}
	\item{Attached file upload, replacement and deletion}
	\item{}
\end{itemize}

\subsection{SB Item identifiers}
\begin{itemize}
	\item{Functionality of item identifiers}
	\item{Example of identifier use}
	\item{How identifiers can be useful for projects}
\end{itemize}<commit_msg>commit to gen pdf, want to see how examples look<commit_after>
\section{The \pkg{sbtools} package}
\begin{itemize}
	\item{Goal to allow programmatic access to core SB functionality}
	\item{Harmonize the SB data structures with common R interfaces}
	\item{Lightweight R package that can be quickly added to existing projects and shared broadly}
\end{itemize}


%code example
% \begin{example}
  % x <- 1:10
  % result <- myFunction(x)
% \end{example}

\subsection{Data access API}
The data access functionality of \pkg{sbtools} makes it easy to 
access any public item's data, attached files and metadata. All items
in ScienceBase have a unique identifier that can be used to directly 
access specific items. 

\begin{example}
	test_item = item_get("4f4e4b24e4b07f02db6aea14")
	test_item
\end{example}

For convenience, \pkg{sbtools} defines an \code{sbitem} object, which is 
returned by \pkg{sbtools} functions when referencing objects. The underlying
data structure is a list. All available metadata for an item can be listed
and accessed in the same way as a named list: 
\being{example}
	names(test_item)
	item_get("4f4e4b24e4b07f02db6aea14")$citation
\end{example}

On ScienceBase, all items are organized in a tree structure, with one 
parent and potentially many children. \pkg{sbtools} allows the user to 
easily traverse the tree structure. In some projects, the hierarchy has 
important meaning. For others, it relates only to the owner user or
organization.

\being{example}
	#parent ID always available as item attribute
	parent = item_get(test_item$parentId)
	parent
	
	#getting sibling items
	item_list_children(parent)
	
\end{example}

ScienceBase allows items to have attached files. Attached files can easily be 
listed and downloaded directly using \code{item_list_files} and 
\code{item_file_download}. These functions are only useful on items 
that have files attached.

\being{example}
	#returns files attached to item
	item_list_files(test_item)
	#returns local path to downloaded files
	item_file_download(test_item, dest_dir = tempdir())
\end{example}

ScienceBase has special support for certain datatypes. 

\begin{example}
	
\end{example}

\begin{itemize}
	\item{Accessing special SB extensions}
	\item{Hierarchy traversal}
\end{itemize}

%code example
% \begin{example}
  % x <- 1:10
  % result <- myFunction(x)
% \end{example}

\subsection{Search API}
\begin{itemize}
	\item{Go over general search API}
	\item{Free text search}
	\item{dateRange query}
	\item{Spatial query}
	\item{Hierarchical SB queries (sub-items)}
	\item{Combination of above}
\end{itemize}

\subsection{ScienceBase authenticated}

\begin{itemize}
	\item{How authentication changes SB}
	\item{Authentication in sbtools}
	\item{Authentication persistence and use throughout package}
	\item{Examples of authentication and other auth-related functions (check and such)}
\end{itemize}

%code example
% \begin{example}
  % x <- 1:10
  % result <- myFunction(x)
% \end{example}

\subsection{Data editing and upload API}
This will be an extensive section
\begin{itemize}
	\item{Item creation}
	\item{Item deletion}
	\item{Attached file upload, replacement and deletion}
	\item{}
\end{itemize}

\subsection{SB Item identifiers}
\begin{itemize}
	\item{Functionality of item identifiers}
	\item{Example of identifier use}
	\item{How identifiers can be useful for projects}
\end{itemize}
{'fraction_non_alphanumeric': 0.08872802481902792, 'fraction_numerical': 0.007238883143743537, 'mean_word_length': 5.067754077791719, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '502110', 'n_tokens_mistral': 1525, 'n_tokens_neox': 1489, 'n_words': 533}