Data

Data formats, units & time

Distinguish plugin events, Room records, and remote representations.

Reviewed
On this page

Three representations

A plugin Event is a common read contract. Room entities and remote upload documents are separate structures. One Event is not a complete export format for every data type.

RepresentationKey fieldsInterpretation
Eventtype, startMs, endMs, valueNum, unit, sourcevalueNum is Kotlin Any, so may contain a number or object
Sensor batchsensorType, startedAt, endedAt, sampleCount, payloadJsonSummary event differs from measurement payload
Health metricmetric, startAt, valueNum/valueStr/valueJson, unit, sourcePackageRead the value representation and unit together
Health sessiontype, startAt, endAt, metaJson, ownerInterval records such as sleep and exercise
Survey responsesurveyId, bundleJson, dedupeKey, revision, syncStateInterpret with occurrence and question structure
External metricMetric name, time, polymorphic valueCheck the game-specific summary

Sensor Event example

This is an illustrative JSON representation of a batch summary, not a public HTTP API response.

CODE
{
  "type": "accelerometer",
  "startMs": 1789603200000,
  "endMs": 1789603260000,
  "valueNum": 40,
  "unit": "samples",
  "source": "sensor"
}

The value 40 is a sample count, not acceleration. Mean acceleration values are in the associated batch payload.

Time and units

Epoch timestamps generally use milliseconds. Audio durationMs and call payload callDuration are also milliseconds, while Health Connect's ingested exercise_duration uses seconds. Similar names do not establish equal units.

Health dayKey and survey occurrences depend on local-date/timezone rules. Interpret zoneOffsetMin, source timestamps, and session boundaries together. Specify the study timezone when converting UTC epoch values to displayed dates.

Samsung paths store heart rate in bpm, pressure in mmHg, and oxygen saturation in %. Compare conversion logic and stored units before combining similarly named metrics from different providers.

Data-quality interpretation

Batch existence, sample count, valid measurements, and successful upload are different criteria. A zero count is not always an observed zero measurement. A remote sensor document marked payloadOmitted may exist without its full payload.

Do not assign ownerless legacy data or another participant's data to the current participant. Extraction should follow the actual storage and sync implementations.

Documentation evidence

Working-tree baseline · source paths · HEAD 8213e6b7

  • core/plugin-api/src/main/java/com/hdil/datacollection/plugin_api/Plugin.kt
  • core/db/src/main/java/com/hdil/datacollection/db/entity/sensor/SensorEntities.kt
  • core/db/src/main/java/com/hdil/datacollection/db/entity/health/HealthEntities.kt
  • core/db/src/main/java/com/hdil/datacollection/db/entity/survey/SurveyEntities.kt
  • core/db/src/main/java/com/hdil/datacollection/db/entity/external/ExternalMetricEntity.kt
  • plugins/healthconnect/src/main/java/com/hdil/datacollection/plugins/healthconnect/HealthConnectPlugin.kt
  • core/store/src/main/java/com/hdil/datacollection/store/sync/SensorFirestoreDataSource.kt
DTRAC AndroidYonsei University · Bongshin Lee’s research team