Local storage
Room is the app's local source of truth. Sensor batches, health metrics/sessions, survey responses, and external metrics pass through their storage layers. Preferences and some state use supporting stores such as DataStore.
A locally saved record can be distinguished from a remotely synchronized one while offline. This does not guarantee offline completion for submission paths that first require authentication or audio upload.
Storage mode and backend
The loader reads manifests/services/backend.json. On read/parse failure, code defaults are backend="firebase" and storageMode="local_and_server".
{
"backend": "firebase",
"storageMode": "local_only"
}
This example selects local-only storage. Use local_and_server for server-backed storage. The Supabase path uses the supabase backend choice and its server configuration. Documentation examples do not contain server keys or real participant information.
Synchronization states
| State | Interpretation |
|---|---|
PENDING | Awaiting upload |
SYNCED | The relevant path marked upload as successful |
FAILED | Failed or quarantined record; check the data-specific policy |
SOFT_DELETED | Deletion state used by some records, including surveys |
Retry and deletion behavior varies by DAO and data source. Not every table has the same transitions or retry interval. Check the local state and remote record after connectivity returns.
Study and participant paths
Firestore uses a study/participant hierarchy. The identifiers below are fictional.
studies/demo-study/participants/demo-participant/
sensor_batches/
survey_responses/
health_metrics/
health_sessions/
external_metrics/
Some paths defer uploads when enrollment identifiers are missing. Supabase has its own data sources; do not apply Firestore paths to it unchanged.
Payloads and audio files
Sensor Firestore uploads prefer payloadJson and handle size limits through compression or omission markers. SYNCED alone does not establish preservation of the full payload.
Voice-response file policies apply separately. A local file path in a record does not prove a remote upload. Conversely, a successful server-only upload can lead to local file cleanup.