Open xubowenhaoren opened 5 years ago
@xubowenhaoren waiting for your update here! 😃
Hello,
Sorry for the late reply. I was trying to confirm that emission-Aware is working side-by-side with emission-original.
AndroidManifest.xml
, where we refactored all emission BroadcastReceivers by appending a "2":
<receiver android:enabled="true" android:name="com.aware.plugin.cmu.sup.DataCollection.BootReceiver2">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<receiver android:enabled="true" android:name="com.aware.plugin.cmu.sup.DataCollection.location.TripDiaryStateMachineReceiver2">
<intent-filter>
<action android:name="local.transition.initialize" />
<action android:name="local.transition.exited_geofence" />
<action android:name="local.transition.stopped_moving" />
<action android:name="local.transition.stop_tracking" />
<action android:name="local.transition.start_tracking" />
<action android:name="local.transition.tracking_error" />
</intent-filter>
</receiver>
<service android:enabled="true" android:exported="false" android:name="com.aware.plugin.cmu.sup.DataCollection.location.ActivityRecognitionChangeIntentService2" />
<service android:enabled="true" android:exported="false" android:name="com.aware.plugin.cmu.sup.DataCollection.location.TripDiaryStateMachineService2" />
<service android:enabled="true" android:exported="false" android:name="com.aware.plugin.cmu.sup.DataCollection.location.TripDiaryStateMachineServiceOngoing2" />
<service android:enabled="true" android:exported="false" android:name="com.aware.plugin.cmu.sup.DataCollection.location.TripDiaryStateMachineForegroundService2" />
<service android:enabled="true" android:exported="false" android:name="com.aware.plugin.cmu.sup.DataCollection.location.GeofenceExitIntentService2" />
<service android:enabled="true" android:exported="false" android:name="com.aware.plugin.cmu.sup.DataCollection.location.LocationChangeIntentService2" />
<service android:enabled="true" android:exported="false" android:name="com.aware.plugin.cmu.sup.DataCollection.location.actions.GeofenceLocationIntentService2" />
<receiver android:enabled="true" android:name="com.aware.plugin.cmu.sup.TransitionNotify.TransitionNotificationReceiver2">
<intent-filter>
<action android:name="local.transition.initialize" />
<action android:name="local.transition.exited_geofence" />
<action android:name="local.transition.stopped_moving" />
<action android:name="local.transition.stop_tracking" />
<action android:name="local.transition.start_tracking" />
</intent-filter>
</receiver>
Hello,
In our latest communication, we discovered that different Google Play versions in the app.gradle
can impact the internal data stored in the userCacheDB
.
In Aware-emission, the implementations are
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-crash:16.2.1'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
implementation "androidx.appcompat:appcompat:1.0.0"
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation "androidx.media:media:1.0.0"
implementation "androidx.fragment:fragment:1.0.0"
api 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.code.gson:gson:2.8.5'
and one example background/motion_activity
record is {"zzbhB":4,"zzbhC":40}
.
In the latest opentoall
branch of emission-original, the implementations are
compile "com.android.support:support-v13:26.+"
compile "me.leolin:ShortcutBadger:1.1.17@aar"
compile "com.google.firebase:firebase-messaging:11.0.1"
compile "com.android.support:support-v4:24.1.1+"
compile "com.android.support:support-v4:+"
compile "com.google.android.gms:play-services-auth:11.0.1"
compile "net.openid:appauth:0.7.0"
compile "com.auth0.android:jwtdecode:1.1.1"
compile "com.google.code.gson:gson:+"
compile "com.google.android.gms:play-services-location:11.0.1"
and one example background/motion_activity
record is {"zzi":2,"zzs":95}
.
Our questions:
background/motion_activity
records and reconstruct trip details, given no human-readable background/motion_activity
headers? background/motion_activity
headers affect the data parsing? If so, how? How would emission-original parse background/motion_activity records and reconstruct trip details, given no human-readable background/motion_activity headers?
Multiple points about background/motion_activity
records
UNKNOWN
There is an open issue to convert the android motion activity entries to a standard format https://github.com/e-mission/e-mission-data-collection/issues/80 which you are welcome to submit a fix for if you like.
However, the workaround of reformatting on the server works fine for now so it is not a high priority fix for the overall e-mission platform.
Hello,
In order to simplify the data syncing with Aware servers and the UI work, we have come up with a preliminary plan to parse the userCacheDB
into trip diaries. Although much of the work here is design-specific, we still want to share it and welcome comments.
trips
that fits the Aware database design. Each row documents one whole trip, including device_id
as user id, timestamp
as the start time, end_time
as the end time, start_location
as the lat & long of the origin, end_location
as the lat & long of the destination, sections
as the section(s) during the trip. Each section should contain individual lat & long lists as in Emission design. This trips
DB will be automatically synced and cleaned (meaning that data synced and stored from a week ago will be removed) by the Aware framework.
After the completion of each trip, the existing emission BroadcastReceivers will send a broadcast. We can utilize this to start a database daemon service that tails the emission userCacheDB
, parse the only trip inside, and stores the parsed results as one row of data in the trips
database. All parsed data in userCacheDB
are removed immediately. In this way, we could avoid tailing long, continued records in userCacheDB
and make mistakes in between.
Now, the UI only needs to read each row in the trips
DB and display the trip information accordingly. No need to parse userCacheDB
every time.
So effectively, you want to re-write the trip and section segmentation algorithms in java to run on the phone? Because right now, for easy extensibility and to compare implementations to pick the best one, the algorithms are written in python and run on the server.
In particular, if you store processed data (e.g. trip outputs), then if somebody (e.g. @jf87) contributes an improved section + mode detection algorithm later, you cannot just reset the pipeline and re-run it to get the improvements, because the raw data is gone. This is why the reproducible pipeline is such a powerful concept.
During the communication, we found that the best practice for the parsing of trips for cross-platform support (iOS, Android) is to still leave the processing on the server. So we will hold back the idea of the trips
DB for the moment.
However, the syncing with Aware servers require a device_id
and timestamps in milliseconds (which is different in emission). How could we make these two changes for emission userCacheDB
on-the-fly to make it compatible for Aware syncing with minimal changes to the codebase?
You can do this in many ways:
If you go to any server - e.g. https://e-mission.eecs.berkeley.edu/#/home Click on Metrics at the top, you can search by time ranges and it should display the distance, duration etc in the aggregate.
Note that this does not work on the main server because the pipeline is not running. Note also that this may be somewhat bitrotted because nobody has actively used it since I built it. But it is effectively the same code as the phone metrics and that I know that works because the European teams are using it. At worst, you may need to port over the bug fixes from the phone metrics screen to the server metrics screen.
Everytime when I visit https://e-mission.eecs.berkeley.edu/#/home on my laptop, this page is always empty. However the web page is working on my phone.
EDIT: disabling the adblocker works.
can you check for popup blockers? @asiripanich reported something similar
Hello,
We have decided to keep the current server architecture for emission during the migration. In terms of syncing, we plan to do this approach:
since aware does not read from the e-mission usercache DB, you can keep the e-mission usercacheDB unchanged, and add in the device ID to each row when reading it for the aware sync (which you have to write anyway).
In this case, can we use the emission-server
unchanged? Which of the versions are more debugging-friendly, the docker distro or the manual install?
Just to be clear, with this syncing approach, you will not be able to pull data from the e-mission server, or will you? is the plan that you will send the data one way to the e-mission server? If you want to pull the data, how will you authenticate to avoid hacking access?
It appears that I have some misunderstanding about the design mod here.
We wish to make minimal changes to the emission server architecture without affecting existing functionalities. This includes two-way upload and downloading of the trip data.
In terms of the authentication, AWARE uses the device_id
for simple verification. When a phone first joins a study, it uploads its randomly generated device_id
to the AWARE database. Then, any data that's uploaded from the phone will have the device_id
attached, so the AWARE database can check against its own devices
table and decide to keep the data upload. Is there a similar design in emission?
So the ultimate question is, at the very end of the study, we want the emission-Aware data to follow Aware standards in that each row of the data has a device_id
and timestamp in ms. However, where this change must occur is still unclear.
so the closest authentication mechanisms to the ones you have listed are "skip" and "token_list". "skip" is probably closer than "token_list". In "skip", you specify an arbitrary string while creating the profile and that string is your auth token going forward.
Note that this is not secure if the string is not randomly generated by the user or the app using a one-time generation key.
As a concrete example, any other app running on the user's phone also has access to their device ID. So if a hacker can convince a user to install their app, they can retrieve the device id and then use it to download the users entire travel data without asking for location permissions from the hacker's app.
If you want to use a skip-like mechanism, you can generate a one-time UUID in the app, not shared with anything else, and use that as the token. You can also, of course, map the UUID to the device id in a table on the server. But you cannot allow retrieval of data based only on the device id due to the potential security implications.
device_id
is generated by the AWARE client for every fresh install.
device_id
. device_id
. We do identification via participant id or PID for short.
device_id
at every fresh install. ok so with these clarifications, it looks like using the device_id
with skip authentication will work. Note, of course, that if the user switches phones or reinstalls the app, the device ID will change, but presumably you have a mechanism in place already to handle that.
In this case, it may be easiest to just push the e-mission data to the e-mission server directly using the existing sync mechanism. You can then pull the data also using the device id for authentication. When you import from e-mission server to aware server, you can add the device id and convert the timestamp and whatever other formatting changes you would like to do.
You still need to make the changes to display the processed data in the native UI.
Based on my discussion with Anat, you do not want to make UI changes unless necessary. If you are pulling processed data from the server, you are not making native calls from javascript, so you could theoretically use a webview to pull and display the trips. But you would have to transfer the deviceid from the native code to the webview.
Which of the versions are more debugging-friendly, the docker distro or the manual install?
both are equally debugging friendly, but the manual install is more development friendly if you want to edit the code to add export functionality.
also, if you want to use the docker image, file an issue asking me to upload a new docker-compose with a cronjob example. I have it locally but I now only do work if requested because I am busy otherwise
Hello,
After discussion with Anat, I've come up with 2 plans for the UI implementation:
If you are pulling processed data from the server, you are not making native calls from javascript, so you could theoretically use a webview to pull and display the trips. But you would have to transfer the deviceid from the native code to the webview.
I also have questions about handling the emission data sync.
In this case, it may be easiest to just push the e-mission data to the e-mission server directly using the existing sync mechanism.
Since we are collecting AWARE and e-mission data separately, there's no need to write a new sync adapter under AWARE. Then, by "existing", do you mean "e-mission existing"? To be more specific, the adapters in this repo?
@xubowenhaoren before we dive too deeply into these answers, did you consider just using the cordova app with the "skip" notification, without using AWARE, given that you are no longer partnering with the other group? Note that using the cordova app will allow your solution to work on both android and iOS.
After discussion with Anat, I've come up with 2 plans for the UI implementation:
Both of these should work. Are you going to try them out, or do you have specific questions for me?
Then, by "existing", do you mean "e-mission existing"?
Yes.
Then, by "existing", do you mean "e-mission existing"? To be more specific, the adapters in this repo?
Sort of. The sync adapter is just a periodically scheduled call. It then calls CommunicationHelper
, for the actual REST API calls - e.g.
https://github.com/e-mission/cordova-server-communication/blob/master/src/android/CommunicationHelper.java#L76
Hi, this is a request/ suggestion for the modularization of trip segmentation feature. E-mission is an excellent trip data collection solution by itself. However, researchers already working with other general data collection frameworks (AWARE, for instance) cannot easily integrate the e-mission functionalities. Therefore, we're requesting the trip segmentation feature to be modularized. Here we are listing some goals, where each goal is a "phase" that provides increasingly more modularization that we'd like to see.
e-mission-data-collection
,e-mission-transition-notify
e-mission/e-mission-phone
:www/templates/diary
,js/diary/
e-mission-server
that supports database syncing with a simple identifier likedevice_id
. Remove other components likeconnectionConfig
,auth
, etc.e-mission-server
. Minimal modification required fore-mission-data-collection
.e-mission-data-collection