diff --git a/docs/change-log.md b/docs/change-log.md index 6a6682fd0..657c1d3f4 100644 --- a/docs/change-log.md +++ b/docs/change-log.md @@ -1,12 +1,14 @@ # Change Log -## v1.10.0 +## v1.9.4 +- Fix bug in PHONE_BATTERY RAPIDS provider that could result in negative values for battery consumption rate features - Fix bug in PHONE_APPLICATIONS_FOREGROUND RAPIDS provider that could result in some rows being excluded from output depending on order in which apps are processed - Fix bug in PHONE_SCREEN RAPIDS provider that dropped rows exceeding specified thresholds based on within-segment rather than overall episode duration - Add mutation script to fix character encoding of bt_name column in phone Bluetooth data - Add mutation script to fix character encoding of package_name, before_text, and current_text columns in phone keyboard data -- Update documentation for Docker and Ubuntu installation +- Specify that R version 4.2.3 be installed in tests workflow and Dockerfile +- Update documentation for Docker, Mac and Ubuntu installation ## v1.9.3 diff --git a/src/features/phone_battery/rapids/main.py b/src/features/phone_battery/rapids/main.py index bc8977195..1855a3e19 100644 --- a/src/features/phone_battery/rapids/main.py +++ b/src/features/phone_battery/rapids/main.py @@ -17,9 +17,14 @@ def rapids_features(sensor_data_files, time_segment, provider, filter_data_by_se if not battery_data.empty: - battery_data["episode_id"] = ((battery_data.battery_status != battery_data.battery_status.shift()) | (battery_data.start_timestamp - battery_data.end_timestamp.shift() > 1)).cumsum() + battery_data["episode_id"] = ( + (battery_data.battery_status != battery_data.battery_status.shift()) | + (battery_data.start_timestamp - battery_data.end_timestamp.shift() > 1) | + ((battery_data.battery_status.isin([3, 4])) & (battery_data.battery_level > battery_data.battery_level.shift())) + ).cumsum() + grouped = battery_data.groupby(by=["local_segment", "episode_id", "battery_status"]) - battery_episodes= grouped[["duration"]].sum() + battery_episodes = grouped[["duration"]].sum() battery_episodes["battery_diff"] = grouped["battery_level"].first() - grouped["battery_level"].last() battery_episodes["battery_consumption_rate"] = battery_episodes["battery_diff"] / battery_episodes["duration"] battery_episodes.reset_index(inplace=True)