Skip to content
fenmeng123Public

About

R package for mobile sensing data preprocessing

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

38 Commits

Folders and files

Repository files navigation

appusageR appusageR logo

appusageR turns Android text exports from APP Usage / Screen Time into structured data for behavioral and mobile-sensing research. It parses logs, reconstructs episodes, summarizes daily app use, evaluates quality, adds application categories, and links sources to self-report records.

Package: 0.3.12 · App dictionary: 2.0.0 · Scientific schema: 0.3.5


Install and explore

Requires R 4.1.0 or later. With the source archive in your working directory, install its dependencies from CRAN and then install the package:

install.packages(c("cli", "jsonlite", "openxlsx", "parallelly", "readxl", "stringi", "tibble"))
install.packages("appusageR_0.3.12.tar.gz", repos = NULL, type = "source")
library(appusageR)
help("appusageR")

The built source archive includes six tutorials. Use vignette(package = "appusageR") to open their index.

Load the shared fictional data and inspect one source:

data(appusage_demo)
record <- appusage_demo$records$mixed_line_meta
head(record$data$daily[, c("date", "app_name", "duration_ms")])
qc <- assess_appusage_qc(record, metadata = record$metadata, participant_id = "105")
qc$qc[c("pass_qc", "analysis_eligible_daily")]

?appusage_demo describes ten standardized records, a 15-upload inventory and a 17-row questionnaire. All apps, identities and responses are fictional. The scenario guide supplies expected counts and totals.

Choose a task

All six tutorials execute their core code with the same installed synthetic data. File-writing steps use temporary directories and one worker.

Task Tutorial source Installed command
1. Read, preprocess, run QC and inspect results Start a project vignette("appusageR-workflow", package = "appusageR")
2. Compare pure and mixed formats Formats and data model vignette("formats-and-data-model", package = "appusageR")
3. Explain QC, blank days and overlapping time QC and audits vignette("day-and-overlap-audits", package = "appusageR")
4. Reuse, diagnose and repair temporary caches Cache recovery vignette("caches-and-recovery", package = "appusageR")
5. Resolve category conflicts and update labels Categories and dictionary vignette("categories-and-dictionary", package = "appusageR")
6. Run two projects and retain survey rows Projects and surveys vignette("projects-and-surveys", package = "appusageR")

The last tutorial includes an all-failure project with five preserved input diagnoses. The category tutorial distinguishes resolved labels, unresolved conflicts, provisional residuals, and insufficient measurement data.

All 61 public functions have runnable examples. The configuration reference (?appusage_configuration) lists the 46 workflow settings and five category-policy arguments, including defaults, units, valid choices, and affected stages.

Run the complete synthetic project

demo("synthetic-project", package = "appusageR", ask = FALSE)

The demo displays the processing status of 15 uploads, their QC results, and the links for all 17 survey rows. It uses two file workers and cleans up its temporary caches when it finishes. See ?appusage_synthetic_project to run the workflow with your own output directory or a single worker.

Data flow

Data flow and cache ownership

Every source has paired proc-1 and proc-2 RDA/JSON caches. Proc-2 contains typed event, episode and daily tables; milliseconds are the numeric duration unit. QC and categories are recorded in proc-2 JSON. Unavailable grains are typed empty tables. Project delivery, source execution, QC pass and grain eligibility use separate denominators.

run_appusage_workflow() plans and resumes a project. run_appusage_projects() runs an explicit registry in order, with file workers inside each project. run_appusage_project_workflow() adds the Wenjuanxing folder/workbook adapter. match_appusage_self_report() preserves every questionnaire row and links by upload sequence and filename. validate_appusage_project(verify = "content") checks required outputs and diagnosed source failures.

Manual application dictionary

The bundled app_category_dictionary 2.0.0 contains 28,088 rows and five character columns: App_Name, App_Name_Repaired, App_UUID, Level_1_Category and Level_2_Category. It has 14 functional L1 categories, 31 functional L2 categories, and the provisional pair Others / Unclassified.

The dictionary retains 11,849 parent rows. Another 16,239 app-name and alias rows cover 14,118 added identities: 1,925 have author-approved functional labels and 12,193 have provisional residual labels. Provisional residuals indicate pending classification, not low observed use or completed independent review.

data(app_category_dictionary)
attr(app_category_dictionary, "dictionary_provenance")$dictionary_version

Package names take priority; exact names can resolve candidates within a package or provide an unambiguous fallback. Unresolved conflicts remain pending. update_app_categories_cache() updates existing proc-2 pairs independently. profile_uncoded_apps() uses distinct participants and selected primary files to prioritize dictionary additions. See tutorial 5 for thresholds and denominators.

Dictionary versions follow independent MAJOR.MINOR.PATCH rules: PATCH corrects existing identities, MINOR adds new identities, and MAJOR changes the taxonomy. See the dictionary version policy and copyright and contributor record.

NEWS · Report an issue

Author: Kunru Song · Kunrusong97@gmail.com · License: GPL-3

About

R package for mobile sensing data preprocessing

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages