From 621f11b2d98cb3e17d86c3be902ebd40f94d3079 Mon Sep 17 00:00:00 2001 From: Primoz Date: Tue, 15 Nov 2022 09:53:31 +0000 Subject: [PATCH] Fix a bug related to wrong user input (duplicated events). --- NaN.png | Bin 22752 -> 0 bytes .../process_user_event_related_segments.py | 32 ++++++++++-------- 2 files changed, 17 insertions(+), 15 deletions(-) delete mode 100644 NaN.png diff --git a/NaN.png b/NaN.png deleted file mode 100644 index ab4c4dce65097d6ca9b3e9ed283ab52b45384611..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 22752 zcmeFZRZv{f`z6{QR?Wja+=ojQ)ph#l-e-Td*7`bFRapidg#-lz0-?*vN~(iEa6TXqc=a_R@D2C) z;s)@+?zwY4{An=?6U1ula8UG|d$2!v_!@((T$&9?x7bd=;IKWMn79xl0f;(d8SIvLA5 z$onPkE-oH^u`EuA1>Ss{Z!V=)kxsG0pd-c)7G`rLILP!}EnLhp7e2`)WB?gqCPCyK=g1YX~waixx`hK7G` zF73^2@F&7P_zG-$2ZyNW=xj$K;Q2Rx#=KRb=I8&k%Z}Fx>;ujPO{I#ht*xQRNC5kf z*i%Mi<>V?2`=xq--IkR10fB*>U|MSG38JVJ+u+;P6yPqh#)_a|;1j+Z{@2SU`~Rs; zS(7-;X;+6$6Ki32!(CNbtp8jX@9Nk{`CnS?C!%Y+fQhVMZxTT`*w_r#_ot}xfnxt{ zf#z0FI&U+Q!yyMCzrn`FjxzqwG1&h*n^7Se+Iq1VKj1rFMk6bg_!LF<Q+Y^A)t+kCNcv9ZBO_NZ~d z#WG>=SRetXJ%3K~Q5`4`WZ|>dabbRX7xekw$n$bqd#=Ld74T+G`$eDBI==z4>C^7r zZnTRf3j)g{ttx=QU|Ct&g8G(<3M^DY)}ClO1$NJy@1TxssnEY!5=fsvf6g>&_qGp| ze=$x{gIN#-zdgL1oZPpiChnugZHkQzz&SY|%>4)nK?x(`=xVaLzd9UmadWUkf>HiSc`Sycb*w z82l{m>e{e``LY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un7g^Pu4j5%d$FAZn>t`H8|SB8g9L8me$z zToMuJ%`=lmv;io8e)K58s_cs6NVQk=-MhCM8@1Nf*B2>dGFe|oM<;u-zr)M>xS}E_ zz>==Hxp}rz{|f~vDXAAQ#xdwRU7LD^T))mD!+QvDuh@Iq2oA5>ug>1HkM98oFIpHr zZ=I#P&C5H-V~j}oz9nTEt|W?C%O&ZYJ)4-876UuF4cfqw0b8HL=t&l&U3FV6QPJji zs+>YX@#EtTALw-Y#!k*Y9HaTqtxnC5xK#X{@o4 zs>+DKMy51Vj95!NaaSqgVA^RH&SV*@+slo6LXM7(6#spYzgXDWnN9jmipt56gZU~0 zmhB;lWd*Iz;05}4`S^yZ6~_SLQd3i-V`6k*>3<7OZNu($ht&g?UY7pQVPaPmr>j?YfD<89=^0XoSG*s;+h6;2vR$p>a!Y-sL?&p#?uMHJvPnE~z z`b~<>pN<^l$?tvAGsAaWMtu7&psF5ldQ<>#hk*|H^tGKashvzNvR8i$_zb2sZ)H9R3k54)#yfotj$G zT#vqRYshj#)YV5}yhk)v5K5t4tX$(q&W;qhs_-@x(NA=*KL|h2^o|TrmQMp9>zh{d z>-T?NL_Y|g!%8|MtBfBFW? z!4qV0O(C)8WU*M?5Yl|V#pQ}}m%cVmZtm~z#>AAu7V=FgES+FF-(Q)%7Ix~>$u{mK zXi6dIWs55)^eDoBbbv|cV&&u9&&)-<<=Njc@5Ef>7ui2@@QX4IYUN{JV kn;Q0ubDRI4zkbxp2*R&Ue_#~`w_(Ik7k{o$$Km$h04#U(U;qFB diff --git a/src/features/phone_esm/straw/process_user_event_related_segments.py b/src/features/phone_esm/straw/process_user_event_related_segments.py index 61559f35..a9c47370 100644 --- a/src/features/phone_esm/straw/process_user_event_related_segments.py +++ b/src/features/phone_esm/straw/process_user_event_related_segments.py @@ -67,10 +67,10 @@ def extract_ers(esm_df): segmenting_method = config["TIME_SEGMENTS"]["TAILORED_EVENTS"]["SEGMENTING_METHOD"] if segmenting_method in ["30_before", "90_before"]: # takes 30-minute peroid before the questionnaire + the duration of the questionnaire - """ '30-minutes and 90-minutes before' have the same fundamental logic with couple of deviations that will be explained below. - Both take x-minute period before the questionnaire that is summed with the questionnaire duration. - All questionnaire durations over 15 minutes are excluded from the querying. - """ + """ '30-minutes and 90-minutes before' have the same fundamental logic with couple of deviations that will be explained below. + Both take x-minute period before the questionnaire that is summed with the questionnaire duration. + All questionnaire durations over 15 minutes are excluded from the querying. + """ # Extract time-relevant information extracted_ers = esm_df.groupby(["device_id", "esm_session"])['timestamp'].apply(lambda x: math.ceil((x.max() - x.min()) / 1000)).reset_index() # questionnaire length extracted_ers["label"] = f"straw_event_{segmenting_method}_" + snakemake.params["pid"] + "_" + extracted_ers.index.astype(str).str.zfill(3) @@ -79,9 +79,9 @@ def extract_ers(esm_df): extracted_ers["shift_direction"] = -1 if segmenting_method == "30_before": - """The method 30-minutes before simply takes 30 minutes before the questionnaire and sums it with the questionnaire duration. - The timestamps are formatted with the help of format_timestamp() method. - """ + """The method 30-minutes before simply takes 30 minutes before the questionnaire and sums it with the questionnaire duration. + The timestamps are formatted with the help of format_timestamp() method. + """ time_before_questionnaire = 30 * 60 # in seconds (30 minutes) extracted_ers["length"] = (extracted_ers["timestamp"] + time_before_questionnaire).apply(lambda x: format_timestamp(x)) @@ -89,9 +89,9 @@ def extract_ers(esm_df): extracted_ers["shift"] = extracted_ers["shift"].apply(lambda x: format_timestamp(x)) elif segmenting_method == "90_before": - """The method 90-minutes before has an important condition. If the time between the current and the previous questionnaire is - longer then 90 minutes it takes 90 minutes, otherwise it takes the original time difference between the questionnaires. - """ + """The method 90-minutes before has an important condition. If the time between the current and the previous questionnaire is + longer then 90 minutes it takes 90 minutes, otherwise it takes the original time difference between the questionnaires. + """ time_before_questionnaire = 90 * 60 # in seconds (90 minutes) extracted_ers[['end_event_timestamp', 'device_id']] = esm_df.groupby(["device_id", "esm_session"])['timestamp'].max().reset_index()[['timestamp', 'device_id']] @@ -135,7 +135,7 @@ def extract_ers(esm_df): extracted_ers = extracted_ers[(~extracted_ers.se_time.str.startswith("0 - ")) & (~extracted_ers.se_duration.str.startswith("0 - "))] # Transform data into its final form, ready for the extraction - extracted_ers.reset_index(inplace=True) + extracted_ers.reset_index(drop=True, inplace=True) time_before_event = 5 * 60 # in seconds (5 minutes) extracted_ers['event_timestamp'] = pd.to_datetime(extracted_ers['se_time']).apply(lambda x: x.timestamp() * 1000).astype('int64') @@ -154,13 +154,15 @@ def extract_ers(esm_df): extracted_ers['se_duration'] = \ extracted_ers['se_duration'].apply(lambda x: math.ceil(x / 1000) if isinstance(x, int) else (pd.to_datetime(x).hour * 60 + pd.to_datetime(x).minute) * 60) + time_before_event - # Exclude events that are longer than 2.5 hours - extracted_ers = extracted_ers[extracted_ers["se_duration"] <= 2.5 * 60 * 60].reset_index(drop=True) - - extracted_ers["label"] = f"straw_event_{segmenting_method}_" + snakemake.params["pid"] + "_" + extracted_ers.index.astype(str).str.zfill(3) extracted_ers['shift'] = format_timestamp(time_before_event) extracted_ers['length'] = extracted_ers['se_duration'].apply(lambda x: format_timestamp(x)) + # Drop event_timestamp duplicates in case of user referencing the same event over multiple questionnaires + extracted_ers.drop_duplicates(subset=["event_timestamp"], keep='first', inplace=True) + extracted_ers.reset_index(drop=True, inplace=True) + + extracted_ers["label"] = f"straw_event_{segmenting_method}_" + snakemake.params["pid"] + "_" + extracted_ers.index.astype(str).str.zfill(3) + # Write the csv of extracted ERS labels with targets (stress event intensity) extracted_ers[["label", "intensity"]].to_csv(snakemake.output[1], index=False)