Notes/ExportFormat.md (7983B)
1# Reportage Export Format
2
3Version 1. Written by `ReportageExporter` and read by `ReportageExport.decode`.
4
5## File
6
7A UTF-8 JSON object:
8
9```json
10{"format":"reportage","version":1,"exportedAt":"2026-10-16T06:00:00Z",
11"questions":[
12{...},
13{...}
14],
15"tokens":[
16...
17],
18"reports":[
19...
20]}
21```
22
23- `format` is always `"reportage"`.
24- `version` is the format version. A reader should reject versions newer than
25 it knows. Fields may be added within a version; a reader should ignore keys
26 it doesn't recognise.
27- Each record is on its own line, so the file can be processed line by line or
28 with `jq`. Keys within a record are sorted.
29- Questions are ordered by `order` then `id`, tokens by `questionID` then `id`,
30 and reports by `date` then `id`.
31- Optional fields are left out when they have no value, rather than written as
32 `null`.
33
34### Dates
35
36Dates are ISO 8601 strings with a numeric offset (RFC 3339). Every date inside
37a report, including those in its context, is written in the report's own time
38zone, so the local time can be read directly from the string:
39`2025-01-15T09:30:00+11:00`. All other dates are in UTC: `...Z`.
40
41Fractional seconds appear only when a date has them, to millisecond precision:
42`2025-01-15T09:31:00.250+11:00`.
43
44## Question
45
46| Key | Type | Notes |
47|---------------|-----------|----------------------------------------------------|
48| `id` | string | Questions imported from Reporter keep Reporter's IDs. |
49| `prompt` | string | The current wording. |
50| `kind` | string | `yesNo`, `choice`, `tokens`, `people`, `location`, `number` or `note`. |
51| `options` | [string]? | The fixed answer list of a `choice` question. |
52| `placeholder` | string? | |
53| `askOn` | [string] | Surveys the question appears in: `random`, `wake`, `bedtime`. Manual reports use the `random` survey. |
54| `order` | integer | Sort order within a survey, and the order answers read in an entry. |
55| `showsInTimeline` | boolean | Whether answers appear in the timeline's entries. Missing in older exports, where it means `true`. |
56| `archivedAt` | date? | Questions are archived, never deleted. |
57| `modifiedAt` | date | |
58
59## Token
60
61A reusable answer to a `tokens`, `people` or `location` question. Responses
62refer to tokens by ID, so a token's `text` is the name of every answer using it.
63
64| Key | Type | Notes |
65|---------------|-----------|----------------------------------------------------|
66| `id` | string | |
67| `questionID` | string | The question the token belongs to. |
68| `text` | string | The name shown. |
69| `place` | object? | Location tokens only. See below. |
70| `mergedInto` | string? | Set when the token was merged into another. Read answers referring to this token as referring to that one, following the chain if it has several steps. |
71| `archivedAt` | date? | |
72| `modifiedAt` | date | |
73
74`place`:
75
76| Key | Type | Notes |
77|---------------|-----------|----------------------------------------------------|
78| `coordinate` | object? | `{"latitude": number, "longitude": number}`, a representative point. |
79| `names` | [object] | Directory names by language: `{"language": "ja", "text": "..."}` (BCP 47 tags). |
80| `externalID` | object? | `{"source": "foursquare" | "mapKit", "value": string}`. |
81
82## Report
83
84| Key | Type | Notes |
85|---------------|-----------|----------------------------------------------------|
86| `id` | string | Uppercase UUID. Imported reports keep Reporter's IDs. |
87| `date` | date | The moment described: when the prompt fired or the passive log was made. |
88| `timeZone` | string | IANA identifier, for example `Asia/Tokyo`. |
89| `kind` | string | `random`, `wake`, `bedtime` or `manual`. |
90| `trigger` | string | `notification`, `app`, `watch`, `intent` or `imported`. |
91| `state` | string | `passive` (logged, awaiting answers) or `complete`. |
92| `promptedAt` | date? | When the notification that prompted it fired. |
93| `completedAt` | date? | When the survey was submitted. |
94| `context` | object | See [Context](#context). `{}` when nothing was captured. |
95| `responses` | [object] | In survey order. See below. |
96| `modifiedAt` | date | |
97
98### Response
99
100| Key | Type | Notes |
101|---------------|-----------|----------------------------------------------------|
102| `questionID` | string | |
103| `prompt` | string | The wording when the question was answered. |
104| `value` | object? | Absent when the question was shown but skipped. |
105
106`value` has exactly one key, which gives its shape:
107
108| Key | Value | Used by |
109|-----------|-----------------------------|----------------------------------|
110| `options` | [string] | `yesNo`, `choice` |
111| `tokens` | [string], token IDs | `tokens`, `people` |
112| `number` | number | `number` |
113| `text` | string | `note` |
114| `place` | object | `location` |
115
116A `place` value is `{"tokenID": string, "coordinate": {...}?, "accuracy":
117number?}`: the place token chosen, and where the answer was given (accuracy in
118metres).
119
120### Context
121
122Every section is optional and absent when it wasn't captured. Units are
123metric.
124
125- `location`: `coordinate`; `altitude` (m); `horizontalAccuracy` and
126 `verticalAccuracy` (m); `speed` (m/s); `course` (degrees from true north);
127 `timestamp` (date of the fix); `placemark`, the address in the user's first
128 language; and `localisedPlacemarks`, the same address in the user's other
129 languages. A placemark has `name`, `subThoroughfare`, `thoroughfare`,
130 `subLocality`, `locality`, `subAdministrativeArea`, `administrativeArea`,
131 `postalCode`, `country`, `inlandWater` and `ocean` (the fields Reporter
132 recorded), and `language` (BCP 47), `countryCode` (ISO 3166-1),
133 `cityWithContext`, `fullAddress` and `shortAddress` (from Apple Maps).
134- `weather`: `source` (`wunderground`, `darkSky` or `weatherKit`);
135 `backfilled` (true when fetched after the fact); `condition`; `temperature`,
136 `feelsLike` and `dewPoint` (°C); `humidity` (0–1); `pressure` (hPa);
137 `windSpeed` and `windGust` (km/h); `windDirection` (degrees, the direction
138 the wind comes from); `visibility` (km); `uvIndex`; `cloudCover` (0–1);
139 `precipitationChance` (0–1); `precipitationToday` (mm since local midnight).
140- `audio`: `source` (`microphone` or `healthEnvironmental`); `average` and
141 `peak` (dB: dBFS from the microphone, dBA SPL from Health).
142- `motion`: `steps` (so far today); `floorsAscended`; `floorsDescended`;
143 `pressure` (kPa); `relativeAltitude` (m).
144- `device`: `batteryLevel` (0–1); `batteryState` (`unplugged`, `charging` or
145 `full`); `connectivity` (`wifi`, `cellular` or `none`).
146- `photos`: `count` (photos taken since the previous report) and `photos`, a
147 list of `{date, coordinate, pixelWidth, pixelHeight, make, model}`, each
148 optional.