-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The DataStream data downloaded in the Export has wrong JSON format and missing data #178
Comments
@yuanchen233 - I think the main problem here is that data is exported from the database directly rather than from the To quote Working_with_models:
I am sure @Whathecode will agree ;-) |
Yup. The endpoints on that service are severely lacking, however, but this should be a prompt to add/work on those. |
This is caused by
This is cuased by webservices' wired design of dataStream database table/entity, we have this 3 table and the notion of
Agreed. Currently, the export endpoint ( the export button on the portal ) performs a database dump. It does not utilize the API of each
Most of the issues are caused by the current design of database, given that they works, retriving data through core endpoints like In short, I think there are a few things we could/should do, some of them might be off topic here:
If we decide to re-design the database later, some word of suggestion from @Whathecode would be very helpful and much appreciated. |
After restarting the server and me collecting some data, I finally managed to look into the data format downloaded from CAWS. It definitely looks much correct'ish now, but there is still something wrong. Here is an example of the data I get from CAWS: [
...
{
"sequenceId": 33568,
"studyDeploymentId": "d173a6a7-878e-498a-98e1-9dc80877a3b1",
"deviceRoleName": "Primary Phone",
"measurement": {
"sensorStartTime": 1737064846099240,
"data": {
"__type": "dk.cachet.carp.heartbeat",
"period": 5,
"deviceType": "dk.cachet.carp.common.application.devices.WeatherService",
"deviceRoleName": "Weather Service"
}
},
"triggerIds": [
0
],
"syncPoint": {
"synchronizedOn": "1970-01-01T00:00:00Z",
"sensorTimestampAtSyncPoint": 0,
"relativeClockSpeed": 1.0
},
"dataStream": {
"studyDeploymentId": "d173a6a7-878e-498a-98e1-9dc80877a3b1",
"deviceRoleName": "Primary Phone",
"dataType": {
"namespace": "dk.cachet.carp",
"name": "heartbeat"
}
}
},
{
"sequenceId": 33569,
"studyDeploymentId": "d173a6a7-878e-498a-98e1-9dc80877a3b1",
"deviceRoleName": "Primary Phone",
"measurement": {
"sensorStartTime": 1737064846099253,
"data": {
"__type": "dk.cachet.carp.heartbeat",
"period": 5,
"deviceType": "dk.cachet.carp.common.application.devices.AirQualityService",
"deviceRoleName": "Air Quality Service"
}
},
"triggerIds": [
0
],
"syncPoint": {
"synchronizedOn": "1970-01-01T00:00:00Z",
"sensorTimestampAtSyncPoint": 0,
"relativeClockSpeed": 1.0
},
"dataStream": {
"studyDeploymentId": "d173a6a7-878e-498a-98e1-9dc80877a3b1",
"deviceRoleName": "Primary Phone",
"dataType": {
"namespace": "dk.cachet.carp",
"name": "heartbeat"
}
}
},
...
] And here is an example (from CARP Core) of what we should get from the [
{
"dataStream": {
"studyDeploymentId": "c9cc5317-48da-45f2-958e-58bc07f34681",
"deviceRoleName": "Participant's phone",
"dataType": "dk.cachet.carp.geolocation"
},
"firstSequenceId": 0,
"measurements": [
{
"sensorStartTime": 1642505045000000,
"data": {
"__type": "dk.cachet.carp.geolocation",
"latitude": 55.68061908805645,
"longitude": 12.582050313435703,
"sensorSpecificData": {
"__type": "dk.cachet.carp.signalstrength",
"rssi": 0
}
}
},
{
"sensorStartTime": 1642505144000000,
"data": {
"__type": "dk.cachet.carp.geolocation",
"latitude": 55.680802203873114,
"longitude": 12.581802212861367
}
}
],
"triggerIds": [
0
]
}
] |
There are several issues with the data I get from CAWS as compared to the CARP Core Domain model:
In general, it still seems like you are not using the CARP Core Domain Model and rather extract data directly from the database @yuanchen233 .... |
When exporting data, in the
data-streams.json
file I wold expect to get correctly formatted JSON according to the CARP Core domain model. But - alas - there are issues.Here is an example of some JSON exported:
data-streams.json
Compared to the CARP Core Domain data model there are several issues with this JSON:
camelCase
andsnake_case
serialization. Default JSON in CARP Core is alwayscamelCase
. For example,first_sequence_id
should befirstSequenceId
(seeDataStreamSequence
).data_stream_id
(which should bedataStreamId
) is a JSON object (and not a number). See DataStreamId for details.id
,last_sequence_id
,created_by
, etc.snapshot
is not part of theDataStreamSequence
domain model. However, theSyncPoint
is but is embedded in this weird "snapshot" thing.The text was updated successfully, but these errors were encountered: