Skip to content

Commit c0b8b82

Browse files
committed
Merge branch 'main' into async-pattern-alignment
Resolves a conflict in operations.md by keeping this branch's 303 See Other polling pattern for the bulk export flow; main's side of the conflict was an indentation-only change.
2 parents 064d719 + 07e999c commit c0b8b82

4 files changed

Lines changed: 112 additions & 49 deletions

File tree

input/fsh/operations.fsh

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@ Description: "Export a view definition. User can provide view definition referen
3838
* parameter[0].part[1].min = 0
3939
* parameter[0].part[1].max = "1"
4040
* parameter[0].part[1].type = #Reference
41+
* parameter[0].part[1].targetProfile = Canonical(ViewDefinition)
4142
* parameter[0].part[1].documentation = "Reference to a ViewDefinition stored on the server."
4243
* parameter[0].part[2].name = #viewResource
4344
* parameter[0].part[2].use = #in
4445
* parameter[0].part[2].min = 0
4546
* parameter[0].part[2].max = "1"
46-
* parameter[0].part[2].type = #Resource
47+
* parameter[0].part[2].type = #CanonicalResource
48+
* parameter[0].part[2].targetProfile = Canonical(ViewDefinition)
4749
* parameter[0].part[2].documentation = "Inline ViewDefinition resource to export."
4850

4951
* parameter[1].name = #clientTrackingId
@@ -254,6 +256,7 @@ Description: "Execute a view definition against supplied or server data."
254256
* parameter[2].scope[0] = #system
255257
* parameter[2].scope[1] = #type
256258
* parameter[2].type = #Reference
259+
* parameter[2].targetProfile = Canonical(ViewDefinition)
257260
* parameter[2].documentation = "Reference to a ViewDefinition stored on the server."
258261

259262
* parameter[3].name = #viewResource
@@ -384,7 +387,9 @@ Description: "Execute a SQLQuery Library against ViewDefinition tables."
384387
* parameter[2].scope[0] = #system
385388
* parameter[2].scope[1] = #type
386389
* parameter[2].type = #Reference
387-
* parameter[2].documentation = "Reference to a SQLQuery Library stored on the server."
390+
* parameter[2].targetProfile[0] = Canonical(SQLQuery)
391+
* parameter[2].targetProfile[1] = Canonical(SQLView)
392+
* parameter[2].documentation = "Reference to a SQLQuery or SQLView Library stored on the server."
388393

389394
* parameter[3].name = #queryResource
390395
* parameter[3].use = #in
@@ -393,7 +398,9 @@ Description: "Execute a SQLQuery Library against ViewDefinition tables."
393398
* parameter[3].scope[0] = #system
394399
* parameter[3].scope[1] = #type
395400
* parameter[3].type = #Library
396-
* parameter[3].documentation = "Inline SQLQuery Library resource to execute."
401+
* parameter[3].targetProfile[0] = Canonical(SQLQuery)
402+
* parameter[3].targetProfile[1] = Canonical(SQLView)
403+
* parameter[3].documentation = "Inline SQLQuery or SQLView Library resource to execute."
397404

398405
* parameter[4].name = #parameters
399406
* parameter[4].use = #in
@@ -459,7 +466,7 @@ Description: "Export SQLQuery Library results asynchronously using the FHIR Asyn
459466
* parameter[0].max = "*"
460467
* parameter[0].scope[0] = #system
461468
* parameter[0].scope[1] = #type
462-
* parameter[0].documentation = "One or more SQLQuery Libraries to export. Each repetition identifies a single query. Applies at system and type level only; at instance level the bound Library identified by the request URL is the query source and this parameter does not apply."
469+
* parameter[0].documentation = "One or more SQLQuery or SQLView Libraries to export. Each repetition identifies a single query. Applies at system and type level only; at instance level the bound Library identified by the request URL is the query source and this parameter does not apply."
463470
* parameter[0].part[0].name = #name
464471
* parameter[0].part[0].use = #in
465472
* parameter[0].part[0].min = 0
@@ -471,13 +478,17 @@ Description: "Export SQLQuery Library results asynchronously using the FHIR Asyn
471478
* parameter[0].part[1].min = 0
472479
* parameter[0].part[1].max = "1"
473480
* parameter[0].part[1].type = #Reference
474-
* parameter[0].part[1].documentation = "Reference to a SQLQuery Library stored on the server."
481+
* parameter[0].part[1].targetProfile[0] = Canonical(SQLQuery)
482+
* parameter[0].part[1].targetProfile[1] = Canonical(SQLView)
483+
* parameter[0].part[1].documentation = "Reference to a SQLQuery or SQLView Library stored on the server."
475484
* parameter[0].part[2].name = #queryResource
476485
* parameter[0].part[2].use = #in
477486
* parameter[0].part[2].min = 0
478487
* parameter[0].part[2].max = "1"
479-
* parameter[0].part[2].type = #Resource
480-
* parameter[0].part[2].documentation = "Inline SQLQuery Library resource to execute."
488+
* parameter[0].part[2].type = #Library
489+
* parameter[0].part[2].targetProfile[0] = Canonical(SQLQuery)
490+
* parameter[0].part[2].targetProfile[1] = Canonical(SQLView)
491+
* parameter[0].part[2].documentation = "Inline SQLQuery or SQLView Library resource to execute."
481492
* parameter[0].part[3].name = #parameters
482493
* parameter[0].part[3].use = #in
483494
* parameter[0].part[3].min = 0
@@ -504,12 +515,14 @@ Description: "Export SQLQuery Library results asynchronously using the FHIR Asyn
504515
* parameter[1].part[1].min = 0
505516
* parameter[1].part[1].max = "1"
506517
* parameter[1].part[1].type = #Reference
518+
* parameter[1].part[1].targetProfile = Canonical(ViewDefinition)
507519
* parameter[1].part[1].documentation = "Reference to a ViewDefinition stored on the server."
508520
* parameter[1].part[2].name = #viewResource
509521
* parameter[1].part[2].use = #in
510522
* parameter[1].part[2].min = 0
511523
* parameter[1].part[2].max = "1"
512-
* parameter[1].part[2].type = #Resource
524+
* parameter[1].part[2].type = #CanonicalResource
525+
* parameter[1].part[2].targetProfile = Canonical(ViewDefinition)
513526
* parameter[1].part[2].documentation = "Inline ViewDefinition resource."
514527

515528
// Input parameters — export control (from $viewdefinition-export)

input/pagecontent/OperationDefinition-ViewDefinitionRun-notes.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,26 @@
88
When using the GET method, the following limitations apply:
99

1010
1. **No Request Body Parameters**: GET requests cannot include parameters that require a request body:
11-
- Cannot provide `viewResource` parameter (inline ViewDefinition)
12-
- Cannot provide `resource` parameter (direct resources to transform)
11+
- Cannot provide `viewResource` parameter (inline ViewDefinition)
12+
- Cannot provide `resource` parameter (direct resources to transform)
1313
2. **Available Parameters**: Only parameters that can be passed as query parameters are supported:
14-
- `_format` - Output format specification
15-
- `header` - Include CSV headers (for CSV format)
16-
- `patient` - Filter by patient reference
17-
- `group` - Filter by group membership
18-
- `_since` - Filter by last updated time
19-
- `_limit` - Limit number of result rows
20-
- `source` - External data source
14+
- `_format` - Output format specification
15+
- `header` - Include CSV headers (for CSV format)
16+
- `patient` - Filter by patient reference
17+
- `group` - Filter by group membership
18+
- `_since` - Filter by last updated time
19+
- `_limit` - Limit number of result rows
20+
- `source` - External data source
2121

2222
3. **Use Cases**: GET is suitable for:
23-
- Instance-level invocations where the ViewDefinition is identified by the URL path
24-
- Simple filtering and formatting of server data
25-
- Quick queries without complex configuration
23+
- Instance-level invocations where the ViewDefinition is identified by the URL path
24+
- Simple filtering and formatting of server data
25+
- Quick queries without complex configuration
2626

2727
4. **When POST is Required**: Use POST instead of GET when you need to:
28-
- Provide an inline ViewDefinition via `viewResource` parameter
29-
- Supply resources directly via `resource` parameter for transformation
30-
- Pass complex parameter values that cannot be represented as query strings
28+
- Provide an inline ViewDefinition via `viewResource` parameter
29+
- Supply resources directly via `resource` parameter for transformation
30+
- Pass complex parameter values that cannot be represented as query strings
3131

3232
#### Data Sources
3333

@@ -135,7 +135,7 @@ Optional filtering parameters:
135135
##### View Reference/Resource Clarification {#viewreference-clarification}
136136

137137
Only one of the `viewReference` or `viewResource` parameters can be provided.
138-
When invoking this operation at the instance level (e.g. ViewDefinition/{id}/$run), the server SHALL automatically infer the `viewReference` parameter from the path parameter.
138+
When invoking this operation at the instance level (e.g. ViewDefinition/{id}/$viewdefinition-run), the server SHALL automatically infer the `viewReference` parameter from the path parameter.
139139

140140
The `viewReference` parameter MAY be specified using any of the following formats:
141141

@@ -222,7 +222,7 @@ resources and every unwrapped bundle entry.
222222
##### Example 1: Instance-level GET with CSV output
223223

224224
```http
225-
GET /ViewDefinition/patient-demographics/$run HTTP/1.1
225+
GET /ViewDefinition/patient-demographics/$viewdefinition-run HTTP/1.1
226226
Accept: text/csv
227227
```
228228

@@ -240,7 +240,7 @@ pt-3,1992-07-08,Williams,Robert
240240
##### Example 2: Type-level POST with inline ViewDefinition
241241

242242
```http
243-
POST /ViewDefinition/$run HTTP/1.1
243+
POST /ViewDefinition/$viewdefinition-run HTTP/1.1
244244
Accept: application/json
245245
Content-Type: application/fhir+json
246246
@@ -278,7 +278,7 @@ Content-Type: application/json
278278
##### Example 3: POST with direct resources
279279

280280
```http
281-
POST /ViewDefinition/$run HTTP/1.1
281+
POST /ViewDefinition/$viewdefinition-run HTTP/1.1
282282
Accept: text/csv
283283
Content-Type: application/fhir+json
284284
@@ -340,7 +340,7 @@ pt-2,2012-03-30,Doe,John
340340
##### Example 4: GET with filters
341341

342342
```http
343-
GET /ViewDefinition/encounters/$run?patient=Patient/123&_limit=10&_format=ndjson HTTP/1.1
343+
GET /ViewDefinition/encounters/$viewdefinition-run?patient=Patient/123&_limit=10&_format=ndjson HTTP/1.1
344344
```
345345

346346
```http
@@ -360,7 +360,7 @@ against each entry. This request is equivalent to Example 3, which passed the
360360
two Patients as discrete `resource` values.
361361

362362
```http
363-
POST /ViewDefinition/$run HTTP/1.1
363+
POST /ViewDefinition/$viewdefinition-run HTTP/1.1
364364
Accept: text/csv
365365
Content-Type: application/fhir+json
366366
@@ -429,7 +429,7 @@ All error responses (4xx and 5xx) SHOULD include an `OperationOutcome` resource
429429
When the server does not support certain parameters, it should return `400 Bad Request`:
430430

431431
```http
432-
GET /ViewDefinition/123/$run?_since=2021-01-01 HTTP/1.1
432+
GET /ViewDefinition/123/$viewdefinition-run?_since=2021-01-01 HTTP/1.1
433433
Accept: application/json
434434
```
435435

@@ -455,7 +455,7 @@ Content-Type: application/fhir+json
455455
When the provided ViewDefinition is invalid, return `422 Unprocessable Entity`:
456456

457457
```http
458-
POST /ViewDefinition/$run HTTP/1.1
458+
POST /ViewDefinition/$viewdefinition-run HTTP/1.1
459459
Content-Type: application/fhir+json
460460
Accept: application/json
461461
@@ -498,7 +498,7 @@ Content-Type: application/fhir+json
498498
When the referenced ViewDefinition does not exist:
499499

500500
```http
501-
GET /ViewDefinition/non-existent/$run HTTP/1.1
501+
GET /ViewDefinition/non-existent/$viewdefinition-run HTTP/1.1
502502
Accept: application/json
503503
```
504504

@@ -523,7 +523,7 @@ Content-Type: application/fhir+json
523523
When required parameters are missing:
524524

525525
```http
526-
POST /ViewDefinition/$run HTTP/1.1
526+
POST /ViewDefinition/$viewdefinition-run HTTP/1.1
527527
Content-Type: application/fhir+json
528528
Accept: text/csv
529529
@@ -554,7 +554,7 @@ Content-Type: application/fhir+json
554554
When an unsupported format is requested:
555555

556556
```http
557-
GET /ViewDefinition/123/$run?_format=xml HTTP/1.1
557+
GET /ViewDefinition/123/$viewdefinition-run?_format=xml HTTP/1.1
558558
```
559559

560560
```http
@@ -579,7 +579,7 @@ Content-Type: application/fhir+json
579579
When filtering by a patient that doesn't exist:
580580

581581
```http
582-
GET /ViewDefinition/lab-results/$run?patient=Patient/non-existent HTTP/1.1
582+
GET /ViewDefinition/lab-results/$viewdefinition-run?patient=Patient/non-existent HTTP/1.1
583583
Accept: application/json
584584
```
585585

input/pagecontent/operations-capability.md

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,36 @@ The CapabilityStatement.rest.resource array SHALL contain an entry for the ViewD
77
- An operation element with:
88
- name = "$viewdefinition-export"
99
- definition = "http://sql-on-fhir.org/OperationDefinition/$viewdefinition-export"
10-
- An operation element with:
11-
- name = "$run"
12-
- definition = "http://sql-on-fhir.org/OperationDefinition/$run"
10+
- An operation element with:
11+
- name = "$viewdefinition-run"
12+
- definition = "http://sql-on-fhir.org/OperationDefinition/$viewdefinition-run"
1313

1414
If the server supports CRUD and search interactions for the ViewDefinition resource type, the interaction array SHALL include the appropriate codes:
1515

1616
- read
17-
- search-type
17+
- search-type
1818
- write
1919
- patch
2020
- delete
2121
- create
2222

23+
The CapabilityStatement.rest.resource array SHALL also contain an entry for the Library resource type (a SQLQuery is a profile of Library) with:
24+
25+
- An operation element with:
26+
- name = "$sqlquery-run"
27+
- definition = "http://sql-on-fhir.org/OperationDefinition/$sqlquery-run"
28+
- An operation element with:
29+
- name = "$sqlquery-export"
30+
- definition = "http://sql-on-fhir.org/OperationDefinition/$sqlquery-export"
31+
32+
If the server supports CRUD and search interactions for the Library resource type, the interaction array SHALL include the appropriate codes:
33+
34+
- read
35+
- search-type
36+
- write
37+
- patch
38+
- delete
39+
- create
2340

2441
## Example
2542

@@ -58,15 +75,32 @@ Content-Type: application/fhir+json
5875
"definition": "http://sql-on-fhir.org/OperationDefinition/$viewdefinition-export"
5976
},
6077
{
61-
"name": "$validate",
62-
"definition": "http://sql-on-fhir.org/OperationDefinition/$validate"
78+
"name": "$viewdefinition-run",
79+
"definition": "http://sql-on-fhir.org/OperationDefinition/$viewdefinition-run"
80+
}
81+
]
82+
},
83+
{
84+
"type": "Library",
85+
"interaction": [
86+
{ "code": "read" },
87+
{ "code": "search-type" },
88+
{ "code": "write" },
89+
{ "code": "patch" },
90+
{ "code": "delete" },
91+
{ "code": "create" }
92+
],
93+
"operation": [
94+
{
95+
"name": "$sqlquery-run",
96+
"definition": "http://sql-on-fhir.org/OperationDefinition/$sqlquery-run"
6397
},
6498
{
65-
"name": "$run",
66-
"definition": "http://sql-on-fhir.org/OperationDefinition/$run"
99+
"name": "$sqlquery-export",
100+
"definition": "http://sql-on-fhir.org/OperationDefinition/$sqlquery-export"
67101
}
68102
]
69103
}]
70104
}]
71105
}
72-
```
106+
```

input/pagecontent/operations.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ The following list of API endpoints are defined:
1212

1313
- CapabilityStatement
1414
- Operation $viewdefinition-export of ViewDefinition
15-
- Operation $run of ViewDefinition
15+
- Operation $viewdefinition-run of ViewDefinition
16+
- Operation $sqlquery-run of Library
17+
- Operation $sqlquery-export of Library
1618

1719
## Use Cases
1820

@@ -122,13 +124,27 @@ The server processes the ViewDefinitions asynchronously and provides progress up
122124

123125
See [Operation $viewdefinition-export of ViewDefinition](OperationDefinition-ViewDefinitionExport.html)
124126

125-
### Operation $run of ViewDefinition
127+
### Operation $viewdefinition-run of ViewDefinition
126128

127-
The `$run` operation provides real-time, synchronous evaluation of ViewDefinitions to transform FHIR resources into tabular format.
129+
The `$viewdefinition-run` operation provides real-time, synchronous evaluation of ViewDefinitions to transform FHIR resources into tabular format.
128130
This operation is designed for interactive development, debugging of ViewDefinitions, and real-time data streaming applications.
129-
It can be invoked at either the type level (ViewDefinition/$run) or instance level (ViewDefinition/{id}/$run), with the ViewDefinition specified either in the request parameters or inferred from the URL path.
131+
It can be invoked at either the type level (ViewDefinition/$viewdefinition-run) or instance level (ViewDefinition/{id}/$viewdefinition-run), with the ViewDefinition specified either in the request parameters or inferred from the URL path.
130132

131133
The operation supports multiple output formats including JSON, NDJSON, CSV, Parquet, and table formats, with the format determined by the Accept header or \_format parameter.
132134
It can process either resources provided directly in the request or resources available on the server, with optional filtering by patient, group, or time parameters. The operation may use chunked transfer encoding for large result sets and includes comprehensive error handling through FHIR OperationOutcome resources for validation and processing errors.
133135

134-
See [Operation $run of ViewDefinition](OperationDefinition-ViewDefinitionRun.html)
136+
See [Operation $viewdefinition-run of ViewDefinition](OperationDefinition-ViewDefinitionRun.html)
137+
138+
### Operation $sqlquery-run of Library
139+
140+
The `$sqlquery-run` operation provides real-time, synchronous execution of a SQLQuery Library against materialised ViewDefinition tables, returning the query results in the requested format.
141+
It can be invoked at the system, type, or instance level, with the query supplied inline, by reference, or inferred from the URL path at instance level.
142+
143+
See [Operation $sqlquery-run of Library](OperationDefinition-SQLQueryRun.html) and the shared [Common Operation Behavior](operations-common.html).
144+
145+
### Operation $sqlquery-export of Library
146+
147+
The `$sqlquery-export` operation is the asynchronous counterpart to `$sqlquery-run`, exporting SQLQuery Library results into formats such as CSV, NDJSON, or Parquet using the FHIR Asynchronous Bulk Data Request pattern.
148+
It accepts one or more queries to export and returns export tasks that can be monitored for progress and completion, suiting it to large-scale query execution with results delivered to file storage.
149+
150+
See [Operation $sqlquery-export of Library](OperationDefinition-SQLQueryExport.html) and the shared [Common Operation Behavior](operations-common.html).

0 commit comments

Comments
 (0)