Skip to content

Commit 17b3f27

Browse files
spicyfalafelclaude
andcommitted
docs: explain ViewDefinition step with links and column mapping details
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9750861 commit 17b3f27

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

docs/tutorials/subscriptions-tutorials/bigquery-aidboxtopicdestination.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ All requests in this tutorial use `Content-Type: application/json`.
141141
| Parameter | Type | Description |
142142
| ---------------------- | ------- | ---------------------------------------------------------------------------------- |
143143
| `serviceAccountKey` | string | Google Service Account JSON key (omit when using Workload Identity or ADC) |
144-
| `skipInitialExport` | boolean | Skip initial export of existing data (default: `false`) |
144+
| `skipInitialExport` | string | Skip initial export of existing data. Set to `"true"` to skip. |
145145
| `cloudSqlConnectionId` | string | BigQuery Connection ID for Cloud SQL federated query (initial export optimization) |
146146
| `location` | string | GCP location for the BigQuery Connection (default: `us`) |
147147
| `emulatorUrl` | string | BigQuery emulator REST URL, e.g., `http://bigquery:9050` (skips authentication) |
@@ -191,6 +191,10 @@ POST /fhir/AidboxSubscriptionTopic
191191

192192
### Step 2: Create ViewDefinition
193193

194+
A [ViewDefinition](../../modules/sql-on-fhir/defining-flat-views-with-view-definitions.md) defines how to transform a complex FHIR resource into a flat table structure suitable for analytics. Each `column` maps a [FHIRPath](https://hl7.org/fhirpath/) expression to a named column in the output table.
195+
196+
In this example, we flatten Patient into 5 columns: `id`, `gender`, `birth_date` from top-level fields, and `family_name`, `given_name` from the first official name (using `forEach` to navigate into the nested `name` array).
197+
194198
```http
195199
POST /fhir/ViewDefinition
196200
@@ -219,6 +223,8 @@ POST /fhir/ViewDefinition
219223
}
220224
```
221225

226+
The column names you define here must match the columns in the BigQuery table (Step 4). See [ViewDefinition documentation](../../modules/sql-on-fhir/defining-flat-views-with-view-definitions.md) for the full syntax including `where` filters, `unionAll`, and type casting.
227+
222228
### Step 3: Materialize ViewDefinition
223229

224230
The ViewDefinition must be [materialized](../../modules/sql-on-fhir/operation-materialize.md) as a database view before the BigQuery module can use it to transform data. Materialization creates a SQL view in the `sof` schema that maps FHIR resources to the flat column structure you defined.
@@ -365,7 +371,7 @@ When a new destination is created, the module automatically exports all existing
365371
To skip the initial export (e.g., the table is already populated or you only need real-time data), add `skipInitialExport`:
366372

367373
```json
368-
{"name": "skipInitialExport", "valueBoolean": true}
374+
{"name": "skipInitialExport", "valueString": "true"}
369375
```
370376

371377
### How it works

0 commit comments

Comments
 (0)