Migrate phone battery sensor to new data stream
parent
824523e32c
commit
f7cf316133
|
@ -102,6 +102,35 @@ Stream columns named `FLAG_TO_MUTATE` means they are extracted from the `FLAG_AS
|
|||
|
||||
None
|
||||
|
||||
??? info "PHONE_BATTERY"
|
||||
|
||||
=== "ANDROID"
|
||||
|
||||
**COLUMN_MAPPINGS**
|
||||
|
||||
| RAPIDS column | Stream column |
|
||||
|----------------------|---------------------|
|
||||
| TIMESTAMP | timestamp |
|
||||
| DEVICE_ID | device_id |
|
||||
| BATTERY_STATUS | battery_status |
|
||||
| BATTERY_LEVEL | battery_level |
|
||||
|
||||
**MUTATION_SCRIPTS**
|
||||
|
||||
None
|
||||
|
||||
=== "IOS"
|
||||
|
||||
**COLUMN_MAPPINGS**
|
||||
|
||||
Same as ANDROID
|
||||
|
||||
**MUTATION_SCRIPTS**
|
||||
|
||||
```bash
|
||||
src/data/streams/mutations/phone/aware/battery_ios_unification.R
|
||||
```
|
||||
|
||||
|
||||
??? info "PHONE_CONVERSATION"
|
||||
|
||||
|
|
|
@ -35,6 +35,16 @@ This is a description of the format RAPIDS needs to process data for the followi
|
|||
| IS_SYSTEM_APP | Device’s pre-installed application |
|
||||
|
||||
|
||||
??? info "PHONE_BATTERY"
|
||||
|
||||
| RAPIDS column | Description |
|
||||
|--------------------|---------------------------------------------------------------------------|
|
||||
| TIMESTAMP | An UNIX timestamp (13 digits) when a row of data was logged |
|
||||
| DEVICE_ID | A string that uniquely identifies a device |
|
||||
| BATTERY_STATUS | An integer that denotes battery status: 0 or 1 = unknown, 2 = charging, 3 = discharging, 4 = not charging, 5 = full |
|
||||
| BATTERY_LEVEL | An integer that denotes battery level |
|
||||
|
||||
|
||||
??? info "PHONE_CONVERSATION"
|
||||
|
||||
| RAPIDS column | Description |
|
||||
|
|
|
@ -46,6 +46,23 @@ PHONE_APPLICATIONS_FOREGROUND:
|
|||
IS_SYSTEM_APP: is_system_app
|
||||
MUTATION_SCRIPTS: # List any python or r scripts that mutate your raw data
|
||||
|
||||
PHONE_BATTERY:
|
||||
ANDROID:
|
||||
COLUMN_MAPPINGS:
|
||||
TIMESTAMP: timestamp
|
||||
DEVICE_ID: device_id
|
||||
BATTERY_STATUS: battery_status
|
||||
BATTERY_LEVEL: battery_level
|
||||
MUTATION_SCRIPTS: # List any python or r scripts that mutate your raw data
|
||||
IOS:
|
||||
COLUMN_MAPPINGS:
|
||||
TIMESTAMP: timestamp
|
||||
DEVICE_ID: device_id
|
||||
BATTERY_STATUS: battery_status
|
||||
BATTERY_LEVEL: battery_level
|
||||
MUTATION_SCRIPTS:
|
||||
- "src/data/streams/mutations/phone/aware/battery_ios_unification.R"
|
||||
|
||||
PHONE_CONVERSATION:
|
||||
ANDROID:
|
||||
COLUMN_MAPPINGS:
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
source("renv/activate.R")
|
||||
library("dplyr", warn.conflicts = F)
|
||||
|
||||
unify_ios_battery <- function(ios_battery){
|
||||
# We only need to unify battery data for iOS client V1. V2 does it out-of-the-box
|
||||
# V1 will not have rows where battery_status is equal to 4
|
||||
if(nrow(ios_battery %>% filter(battery_status == 4)) == 0)
|
||||
ios_battery <- ios_battery %>%
|
||||
mutate(battery_status = replace(battery_status, battery_status == 3, 5),
|
||||
battery_status = replace(battery_status, battery_status == 1, 3))
|
||||
return(ios_battery)
|
||||
}
|
||||
|
||||
main <- function(data){
|
||||
return(unify_ios_battery(data))
|
||||
}
|
|
@ -19,6 +19,12 @@ PHONE_APPLICATIONS_FOREGROUND:
|
|||
- APPLICATION_NAME
|
||||
- IS_SYSTEM_APP
|
||||
|
||||
PHONE_BATTERY:
|
||||
- TIMESTAMP
|
||||
- DEVICE_ID
|
||||
- BATTERY_STATUS
|
||||
- BATTERY_LEVEL
|
||||
|
||||
PHONE_CONVERSATION:
|
||||
- TIMESTAMP
|
||||
- DEVICE_ID
|
||||
|
|
Loading…
Reference in New Issue