<jupyter_start><jupyter_text>Niimpy introductionNiimpy allows you to access Koota sqlite databases easily.  Demo<jupyter_code># Insert path to use the version from this repository
import sys
sys.path.insert(0, '..')
import niimpy
# Or to automatically reload (only needed if doing niimpy development)
%load_ext autoreload
%autoreload 1
%aimport niimpy
data = niimpy.open(niimpy.sampledata.DATA)<jupyter_output>Detected single-user database<jupyter_text>This sample data is a single-user database - basically, it doesn't have `user` and `device` columns.  The `user` column will identify which user the data belongs to, and in a multi-user database, you can select a certain user by using a standard `user=` argument.A user can have multiple devices of the same type, and different devices are identified with the `device` column.  Currently there is no advanced support for this.<jupyter_code># This returns nothing, because this is a single-user database
# Otherwise, it would return a list of all user hashes
data.users()
# The sample data included with niimpy only has AwareScreen data.
# You can read about the AWARE Screen sensor here:
#   http://www.awareframework.com/screen/
data.tables()<jupyter_output><empty_output><jupyter_text>Looking at the data You can look at raw data (this is basically the exact columns in the database)<jupyter_code>screen = data.raw('AwareScreen', None)
# This is a pandas DataFrame
screen.head()<jupyter_output><empty_output><jupyter_text>Get the first timestamp of the data<jupyter_code>data.first('AwareScreen', None)['datetime'][0]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07927590511860175, 'fraction_numerical': 0.0018726591760299626, 'mean_word_length': 5.9393939393939394, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '378914', 'license': 'MIT', 'n_tokens_mistral': 481, 'n_tokens_neox': 466, 'n_words': 187, 'path': 'docs/Introduction.ipynb', 'repo_name': 'rkdarst/example', 'size': '1602'}