Added testing for screen features (android)

pull/95/head
kaguillera 2020-06-17 16:23:00 -04:00
parent 08a78f6622
commit 5627a73a67
11 changed files with 70 additions and 3 deletions

View File

@ -10,6 +10,8 @@ rule all:
input:
expand("data/raw/{pid}/{sensor}_raw.csv", pid=config["PIDS"], sensor=config["SENSORS"]),
expand("data/raw/{pid}/{sensor}_with_datetime.csv", pid=config["PIDS"], sensor=config["SENSORS"]),
expand("data/processed/{pid}/screen_deltas.csv", pid=config["PIDS"]),
expand("data/interim/{pid}/phone_sensed_bins.csv", pid=config["PIDS"]),
expand("data/processed/{pid}/sms_{sms_type}_{day_segment}.csv",
pid=config["PIDS"],
sms_type = config["SMS"]["TYPES"],
@ -18,6 +20,9 @@ rule all:
pid=config["PIDS"],
call_type=config["CALLS"]["TYPES"],
segment = config["CALLS"]["DAY_SEGMENTS"]),
expand("data/processed/{pid}/screen_{day_segment}.csv",
pid = config["PIDS"],
day_segment = config["SCREEN"]["DAY_SEGMENTS"]),
rule clean:
shell:

View File

@ -0,0 +1,2 @@
local_date,screen_afternoon_countepisodeunlock,screen_afternoon_episodepersensedminutesunlock,screen_afternoon_sumdurationunlock,screen_afternoon_maxdurationunlock,screen_afternoon_mindurationunlock,screen_afternoon_avgdurationunlock,screen_afternoon_stddurationunlock,screen_afternoon_firstuseafter00unlock
2020-06-01,3,0.06,30.08298333333333,12.55,8.533333333333333,10.02766111111111,2.1968176781889985,43200
1 local_date screen_afternoon_countepisodeunlock screen_afternoon_episodepersensedminutesunlock screen_afternoon_sumdurationunlock screen_afternoon_maxdurationunlock screen_afternoon_mindurationunlock screen_afternoon_avgdurationunlock screen_afternoon_stddurationunlock screen_afternoon_firstuseafter00unlock
2 2020-06-01 3 0.06 30.08298333333333 12.55 8.533333333333333 10.02766111111111 2.1968176781889985 43200

View File

@ -0,0 +1,2 @@
local_date,screen_daily_countepisodeunlock,screen_daily_episodepersensedminutesunlock,screen_daily_sumdurationunlock,screen_daily_maxdurationunlock,screen_daily_mindurationunlock,screen_daily_avgdurationunlock,screen_daily_stddurationunlock,screen_daily_firstuseafter00unlock
2020-06-01,7,0.04,94.60658333333333,21.6598833333333,5.9910166666666695,13.51522619047619,6.19241804679586,10230
1 local_date screen_daily_countepisodeunlock screen_daily_episodepersensedminutesunlock screen_daily_sumdurationunlock screen_daily_maxdurationunlock screen_daily_mindurationunlock screen_daily_avgdurationunlock screen_daily_stddurationunlock screen_daily_firstuseafter00unlock
2 2020-06-01 7 0.04 94.60658333333333 21.6598833333333 5.9910166666666695 13.51522619047619 6.19241804679586 10230

View File

@ -0,0 +1,8 @@
"episode_id","episode","screen_sequence","time_diff","local_start_date_time","local_end_date_time","local_start_date","local_end_date","local_start_day_segment","local_end_day_segment"
3,"unlock","3, 0",5.99101666666667,"2020-06-01 02:50:30","2020-06-01 02:56:30","2020-06-01","2020-06-01","night","night"
7,"unlock","3, 0",6.99016666666667,"2020-06-01 05:56:51","2020-06-01 06:03:51","2020-06-01","2020-06-01","night","morning"
11,"unlock","3, 0",21.6598833333333,"2020-06-01 10:00:24","2020-06-01 10:22:04","2020-06-01","2020-06-01","morning","morning"
15,"unlock","3, 0",14.9953833333333,"2020-06-01 11:57:33","2020-06-01 12:12:33","2020-06-01","2020-06-01","morning","afternoon"
19,"unlock","3, 0",8.99965,"2020-06-01 14:51:02","2020-06-01 15:00:02","2020-06-01","2020-06-01","afternoon","afternoon"
23,"unlock","3, 0",16.9834166666667,"2020-06-01 17:51:27","2020-06-01 18:08:26","2020-06-01","2020-06-01","afternoon","evening"
27,"unlock","3, 0",18.9870666666667,"2020-06-01 20:42:58","2020-06-01 21:01:58","2020-06-01","2020-06-01","evening","evening"
1 episode_id episode screen_sequence time_diff local_start_date_time local_end_date_time local_start_date local_end_date local_start_day_segment local_end_day_segment
2 3 unlock 3, 0 5.99101666666667 2020-06-01 02:50:30 2020-06-01 02:56:30 2020-06-01 2020-06-01 night night
3 7 unlock 3, 0 6.99016666666667 2020-06-01 05:56:51 2020-06-01 06:03:51 2020-06-01 2020-06-01 night morning
4 11 unlock 3, 0 21.6598833333333 2020-06-01 10:00:24 2020-06-01 10:22:04 2020-06-01 2020-06-01 morning morning
5 15 unlock 3, 0 14.9953833333333 2020-06-01 11:57:33 2020-06-01 12:12:33 2020-06-01 2020-06-01 morning afternoon
6 19 unlock 3, 0 8.99965 2020-06-01 14:51:02 2020-06-01 15:00:02 2020-06-01 2020-06-01 afternoon afternoon
7 23 unlock 3, 0 16.9834166666667 2020-06-01 17:51:27 2020-06-01 18:08:26 2020-06-01 2020-06-01 afternoon evening
8 27 unlock 3, 0 18.9870666666667 2020-06-01 20:42:58 2020-06-01 21:01:58 2020-06-01 2020-06-01 evening evening

View File

@ -0,0 +1,2 @@
local_date,screen_evening_countepisodeunlock,screen_evening_episodepersensedminutesunlock,screen_evening_sumdurationunlock,screen_evening_maxdurationunlock,screen_evening_mindurationunlock,screen_evening_avgdurationunlock,screen_evening_stddurationunlock,screen_evening_firstuseafter00unlock
2020-06-01,2,0.044444444444444446,27.420400000000033,18.9870666666667,8.433333333333334,13.710200000000016,7.462616406834528,64800
1 local_date screen_evening_countepisodeunlock screen_evening_episodepersensedminutesunlock screen_evening_sumdurationunlock screen_evening_maxdurationunlock screen_evening_mindurationunlock screen_evening_avgdurationunlock screen_evening_stddurationunlock screen_evening_firstuseafter00unlock
2 2020-06-01 2 0.044444444444444446 27.420400000000033 18.9870666666667 8.433333333333334 13.710200000000016 7.462616406834528 64800

View File

@ -0,0 +1,2 @@
local_date,screen_morning_countepisodeunlock,screen_morning_episodepersensedminutesunlock,screen_morning_sumdurationunlock,screen_morning_maxdurationunlock,screen_morning_mindurationunlock,screen_morning_avgdurationunlock,screen_morning_stddurationunlock,screen_morning_firstuseafter00unlock
2020-06-01,3,0.06666666666666667,27.943216666666636,21.6598833333333,2.433333333333333,9.314405555555545,10.714935943920263,21600
1 local_date screen_morning_countepisodeunlock screen_morning_episodepersensedminutesunlock screen_morning_sumdurationunlock screen_morning_maxdurationunlock screen_morning_mindurationunlock screen_morning_avgdurationunlock screen_morning_stddurationunlock screen_morning_firstuseafter00unlock
2 2020-06-01 3 0.06666666666666667 27.943216666666636 21.6598833333333 2.433333333333333 9.314405555555545 10.714935943920263 21600

View File

@ -0,0 +1,2 @@
local_date,screen_night_countepisodeunlock,screen_night_episodepersensedminutesunlock,screen_night_sumdurationunlock,screen_night_maxdurationunlock,screen_night_mindurationunlock,screen_night_avgdurationunlock,screen_night_stddurationunlock,screen_night_firstuseafter00unlock
2020-06-01,2,0.05714285714285714,9.124350000000003,5.9910166666666695,3.1333333333333333,4.562175000000002,2.0206872634837794,10230
1 local_date screen_night_countepisodeunlock screen_night_episodepersensedminutesunlock screen_night_sumdurationunlock screen_night_maxdurationunlock screen_night_mindurationunlock screen_night_avgdurationunlock screen_night_stddurationunlock screen_night_firstuseafter00unlock
2 2020-06-01 2 0.05714285714285714 9.124350000000003 5.9910166666666695 3.1333333333333333 4.562175000000002 2.0206872634837794 10230

View File

@ -0,0 +1,29 @@
timestamp,device_id,screen_status
1590994230386,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,1
1590994230688,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,3
1590994590149,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,0
1590994590775,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,2
1591005411491,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,1
1591005411795,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,3
1591005831205,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,0
1591005831699,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,2
1591020022531,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,1
1591020024938,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,3
1591021324531,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,0
1591021324957,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,2
1591027053231,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,1
1591027053831,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,3
1591027953554,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,0
1591027953954,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,2
1591037462155,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,1
1591037462512,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,3
1591038002491,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,0
1591038002938,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,2
1591048286712,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,1
1591048287050,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,3
1591049306055,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,0
1591049306405,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,2
1591058578480,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,1
1591058578811,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,3
1591059718035,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,0
1591059718492,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,2
1 timestamp device_id screen_status
2 1590994230386 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 1
3 1590994230688 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 3
4 1590994590149 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 0
5 1590994590775 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 2
6 1591005411491 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 1
7 1591005411795 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 3
8 1591005831205 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 0
9 1591005831699 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 2
10 1591020022531 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 1
11 1591020024938 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 3
12 1591021324531 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 0
13 1591021324957 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 2
14 1591027053231 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 1
15 1591027053831 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 3
16 1591027953554 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 0
17 1591027953954 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 2
18 1591037462155 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 1
19 1591037462512 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 3
20 1591038002491 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 0
21 1591038002938 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 2
22 1591048286712 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 1
23 1591048287050 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 3
24 1591049306055 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 0
25 1591049306405 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 2
26 1591058578480 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 1
27 1591058578811 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 3
28 1591059718035 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 0
29 1591059718492 wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun 2

View File

@ -1,9 +1,18 @@
#!/bin/bash
# Commmands necessary to setup and run the tests for RAPIDS
echo Setting up for testing...
echo Copying files...
cp -r tests/data/raw/* data/raw
cp tests/data/external/* data/external
echo Disabling downloading of dataset...
sed -e '10,20 s/^/#/' -e 's/rules.download_dataset.output/"data\/raw\/\{pid\}\/\{sensor\}_raw\.csv"/' rules/preprocessing.snakefile > tmp
cp tmp rules/preprocessing.snakefile
echo Disabling downloading of dataset...
snakemake --profile tests/settings
echo Running tests on data produced...
python -m unittest discover tests/scripts/ -v

View File

@ -2,4 +2,4 @@ directory: ./
configfile: ./tests/settings/testing_config.yaml
snakefile: ./tests/Snakefile
cores: 1
forcerun: [sms_features, call_features]
forcerun: [sms_features, call_features, screen_features]

View File

@ -1,5 +1,5 @@
# Valid database table name
SENSORS: [messages, calls]
SENSORS: [messages, calls, screen]
# Test Participant data to include in the unit testing
# You must create a file for each participant
@ -26,3 +26,9 @@ CALLS:
incoming: [count, distinctcontacts, meanduration, sumduration, minduration, maxduration, stdduration, modeduration, entropyduration, timefirstcall, timelastcall, countmostfrequentcontact]
outgoing: [count, distinctcontacts, meanduration, sumduration, minduration, maxduration, stdduration, modeduration, entropyduration, timefirstcall, timelastcall, countmostfrequentcontact]
DAY_SEGMENTS: *day_segments
SCREEN:
DAY_SEGMENTS: *day_segments
REFERENCE_HOUR_FIRST_USE: 0
FEATURES_DELTAS: ["countepisode", "episodepersensedminutes", "sumduration", "maxduration", "minduration", "avgduration", "stdduration", "firstuseafter"]
EPISODE_TYPES: ["unlock"]