You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/healthcare-apis/fhir/how-to-do-custom-search.md
+20-22Lines changed: 20 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,10 +10,10 @@ ms.author: kesheth
10
10
---
11
11
# Defining custom search parameters
12
12
13
-
The FHIR specification defines a set of search parameters that apply to all resources. Additionally, FHIR defines many search parameters that are specific to certain resources. There are scenarios, however, where you might want to search against an element in a resource that isn’t defined by the FHIR specification as a standard search parameter. This article describes how you can define your own custom [search parameters](https://www.hl7.org/fhir/searchparameter.html) for use in the FHIR service in Azure Health Data Services.
13
+
The FHIR® specification defines a set of search parameters that apply to all resources. Additionally, FHIR defines many search parameters that are specific to certain resources. However, you might also want to search against an element in a resource that isn’t defined by the FHIR specification as a standard search parameter. This article describes how you can define your own custom [search parameters](https://www.hl7.org/fhir/searchparameter.html) for use in the FHIR service in Azure Health Data Services.
14
14
15
15
> [!NOTE]
16
-
> Each time you create, update, or delete a search parameter, you’ll need to run a [reindex job](how-to-run-a-reindex.md) to enable the search parameter for live production. Below we will outline how you can test search parameters before reindexing the entire FHIR service database.
16
+
> Each time you create, update, or delete a search parameter, you’ll need to run a [reindex job](how-to-run-a-reindex.md) to enable the search parameter for live production. We will outline how you can test search parameters before reindexing the entire FHIR service database following.
17
17
18
18
## Create new search parameter
19
19
@@ -23,11 +23,11 @@ To create a new search parameter, you need to `POST` a `SearchParameter` resourc
23
23
POST {{FHIR_URL}}/SearchParameter
24
24
```
25
25
26
-
The examples below demonstrate creating new custom search parameter
26
+
The following examples demonstrate creating a new custom search parameter.
27
27
28
-
### Create new search parameter per definition in Implementation Guide
28
+
### Create new search parameter per definition in the Implementation Guide
29
29
30
-
The code example below shows how to add the [US Core Race search parameter](http://hl7.org/fhir/us/core/STU3.1.1/SearchParameter-us-core-race.html) to the `Patient` resource type in your FHIR service database.
30
+
The following code example shows how to add the [US Core Race search parameter](http://hl7.org/fhir/us/core/STU3.1.1/SearchParameter-us-core-race.html) to the `Patient` resource type in your FHIR service database.
31
31
32
32
33
33
```rest
@@ -73,7 +73,7 @@ The code example below shows how to add the [US Core Race search parameter](http
73
73
```
74
74
### Create new search parameter for resource attributes with reference type
75
75
76
-
The code example shows how to create a custom search parameter to search MedicationDispense resources based on the location where they were dispensed. This is an example of adding custom search parameter for a Reference type.
76
+
The following code example shows how to create a custom search parameter to search MedicationDispense resources based on the location where they were dispensed. This is an example of adding a custom search parameter for a Reference type.
77
77
78
78
```rest
79
79
{
@@ -94,25 +94,25 @@ The code example shows how to create a custom search parameter to search Medicat
94
94
> [!NOTE]
95
95
> The new search parameter will appear in the capability statement of the FHIR service after you `POST` the search parameter to the database **and** reindex your database. Viewing the `SearchParameter` in the capability statement is the only way to tell if a search parameter is supported in your FHIR service. If you cannot find the `SearchParameter` in the capability statement, then you still need to reindex your database to activate the search parameter. You can `POST` multiple search parameters before triggering a reindex operation.
96
96
97
-
Important elements of a `SearchParameter` resource:
97
+
Important elements of a `SearchParameter` resource are:
98
98
99
99
*`url`: A unique key to describe the search parameter. Organizations such as HL7 use a standard URL format for the search parameters that they define, as shown above in the US Core Race search parameter.
100
100
101
-
*`code`: The value stored in the **code** element is the name used for the search parameter when it's included in an API call. For the example above with the "US Core Race" extension, you would search with `GET {{FHIR_URL}}/Patient?race=<code>` where `<code>` is in the value set from the specified coding system. This call would retrieve all patients of a certain race.
101
+
*`code`: The value stored in the **code** element is the name used for the search parameter when it's included in an API call. For the preceding example with the "US Core Race" extension, you would search with `GET {{FHIR_URL}}/Patient?race=<code>` where `<code>` is in the value set from the specified coding system. This call would retrieve all patients of a certain race.
102
102
103
-
*`base`: Describes which resource type(s) the search parameter applies to. If the search parameter applies to all resources, you can use `Resource`; otherwise, you can list all the relevant resource types.
103
+
*`base`: Describes which resource types the search parameter applies to. If the search parameter applies to all resources, you can use `Resource`; otherwise, you can list all the relevant resource types.
104
104
105
-
*`target`: Describes which resource type(s) the search parameter matches to.
105
+
*`target`: Describes which resource types the search parameter matches to.
106
106
107
107
*`type`: Describes the data type for the search parameter. Type is limited by the support for data types in the FHIR service. This means that you can’t define a search parameter of type Special or define a [composite search parameter](overview-of-search.md) unless it's a supported combination.
108
108
109
109
*`expression`: Describes how to calculate the value for the search. When describing a search parameter, you must include the expression, even though it isn't required by the specification. This is because you need either the expression or the xpath syntax and the FHIR service ignores the xpath syntax.
110
110
111
111
## Test new search parameters
112
112
113
-
While you can’t use the new search parameters in production until you run a reindex job, there are a few ways to test your custom search parameters before reindexing the entire database.
113
+
While you can’t use the new search parameters in production until you run a reindex job, there are ways to test your custom search parameters before reindexing the entire database.
114
114
115
-
First, you can test a new search parameter to see what values will be returned. By running the command below against a specific resource instance (by supplying the resource ID), you get back a list of value pairs with the search parameter name and the value stored in the corresponding element. This list includes all of the search parameters for the resource. You can scroll through to find the search parameter you created. Running this command won't change any behavior in your FHIR service.
115
+
First, you can test a new search parameter to see what values are returned. By running the following command against a specific resource instance (by supplying the resource ID), you get back a list of value pairs with the search parameter name and the value stored in the corresponding element. This list includes all of the search parameters for the resource. You can scroll through to find the search parameter you created. Running this command won't change any behavior in your FHIR service.
116
116
117
117
```rest
118
118
GET https://{{FHIR_URL}}/{{RESOURCE}}/{{RESOURCE_ID}}/$reindex
@@ -151,7 +151,7 @@ The result looks like this:
151
151
...}
152
152
```
153
153
154
-
Once you see that your search parameter is displaying as expected, you can reindex a single resource to test searching with your new search parameter. To reindex a single resource:
154
+
Once you see that your search parameter is displaying as expected, you can reindex a single resource to test searching with your new search parameter. To reindex a single resource, use the following.
155
155
156
156
```rest
157
157
POST https://{{FHIR_URL}/{{RESOURCE}}/{{RESOURCE_ID}}/$reindex
@@ -172,21 +172,23 @@ And then do a test search
172
172
GET {{FHIR_URL}}/Patient?race=2028-9
173
173
x-ms-use-partial-indices: true
174
174
```
175
+
175
176
1. For Location (reference type):
176
177
```rest
177
178
{{fhirurl}}/MedicationDispense?location=<locationid referenced in MedicationDispense Resource>
178
179
x-ms-use-partial-indices: true
179
180
```
180
-
After you've tested your new search parameter and confirmed that it's working as expected, run or schedule your reindex job so the new search parameter(s) can be used in live production.
181
+
182
+
After you've tested your new search parameter and confirmed that it's working as expected, run or schedule your reindex job so the new search parameters can be used in live production.
181
183
182
184
See [Running a reindex job](../fhir/how-to-run-a-reindex.md) for information on how to reindex your FHIR service database.
183
185
184
186
## Update a search parameter
185
187
186
-
To update a search parameter, use `PUT` to create a new version of the search parameter. You must include the search parameter ID in the `id` field in the body of the `PUT` request as well as the `PUT` request string.
188
+
To update a search parameter, use `PUT` to create a new version of the search parameter. You must include the search parameter ID in the `id` field in the body of the `PUT` request and the `PUT` request string.
187
189
188
190
> [!NOTE]
189
-
> If you don't know the ID for your search parameter, you can search for it using `GET {{FHIR_URL}}/SearchParameter`. This will return all custom as well as standard search parameters, and you can scroll through the list to find the search parameter you need. You could also limit the search by name. As shown in the example request below, the name of the custom `SearchParameter` resource instance is `USCoreRace`. You could search for this `SearchParameter` resource by name using `GET {{FHIR_URL}}/SearchParameter?name=USCoreRace`.
191
+
> If you don't know the ID for your search parameter, you can search for it using `GET {{FHIR_URL}}/SearchParameter`. This will return all custom and standard search parameters. You can scroll through the list to find the search parameter you need. You could also limit the search by name. As shown in the following example request, the name of the custom `SearchParameter` resource instance is `USCoreRace`. You could search for this `SearchParameter` resource by name using `GET {{FHIR_URL}}/SearchParameter?name=USCoreRace`.
190
192
191
193
```rest
192
194
PUT {{FHIR_URL}}/SearchParameter/{{SearchParameter_ID}}
@@ -237,11 +239,9 @@ The result of the above request will be an updated `SearchParameter` resource.
237
239
> [!Warning]
238
240
> Be careful when updating search parameters. Changing an existing search parameter could have impacts on the expected behavior. We recommend running a reindex job immediately.
239
241
240
-
241
-
242
242
## Delete a search parameter
243
243
244
-
If you need to delete a search parameter, use the following:
244
+
If you need to delete a search parameter, use the following.
> Be careful when deleting search parameters. Deleting an existing search parameter could have impacts on the expected behavior. We recommend running a reindex job immediately.
252
252
253
-
254
-
255
253
## Next steps
256
254
257
255
In this article, you’ve learned how to create a custom search parameter. Next you can learn how to reindex your FHIR service database.
@@ -260,4 +258,4 @@ For more information, see
260
258
>[!div class="nextstepaction"]
261
259
>[How to run a reindex job](how-to-run-a-reindex.md)
262
260
263
-
FHIR® is a registered trademark of [HL7](https://hl7.org/fhir/) and is used with the permission of HL7.
Copy file name to clipboardExpand all lines: articles/healthcare-apis/fhir/how-to-run-a-reindex.md
+18-17Lines changed: 18 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,17 +10,17 @@ ms.author: kesheth
10
10
---
11
11
# Running a reindex job
12
12
13
-
There are scenarios where you may have search parameters in the FHIR service in Azure Health Data Services that haven't yet been indexed. This scenario is relevant when you define your own custom search parameters. Until the search parameter is indexed, it can't be used in live production. This article covers how to run a reindex job to index any custom search parameters that haven't yet been indexed in your FHIR service database.
13
+
There are scenarios where you may have search parameters in the FHIR® service in Azure Health Data Services that have yet to be indexed. This scenario is relevant when you define your own custom search parameters. Until a search parameter is indexed, it can't be used in live production. This article covers how to run a reindex job to index any custom search parameters in your FHIR service database.
14
14
15
15
> [!Warning]
16
16
> It's important that you read this entire article before getting started. A reindex job can be very performance intensive. This article discusses options for how to throttle and control a reindex job.
17
17
18
18
## How to run a reindex job
19
19
20
-
Reindex job can be executed against entire FHIR service database and against specific custom search parameter.
20
+
A reindex job can be executed against an entire FHIR service database, and against specific custom search parameters.
21
21
22
-
### Run reindex job on entire FHIR service database
23
-
To run reindex job, use the following `POST` call with the JSON formatted `Parameters` resource in the request body:
22
+
### Run a reindex job on entire FHIR service database
23
+
To run a reindex job, use the following `POST` call with the JSON formatted `Parameters` resource in the request body.
### Run reindex job against specific custom search parameter
96
-
To run reindex job against specific custom search parameter, use the following `POST` call with the JSON formatted `Parameters` resource in the request body:
95
+
96
+
### Run a reindex job against a specific custom search parameter
97
+
To run a reindex job against a specific custom search parameter, use the following `POST` call with the JSON formatted `Parameters` resource in the request body.
> To check the status of a reindex job or to cancel the job, you'll need the reindex ID. This is the `"id"` carried in the `"parameter"` value returned in the response. In the example above, the ID for the reindex job would be `560c7c61-2c70-4c54-b86d-c53a9d29495e`.
116
+
> To check the status of, or cancel a reindex job, you need the reindex ID. This is the `"id"` carried in the `"parameter"` value of the response. In the preceding example, the ID for the reindex job would be `560c7c61-2c70-4c54-b86d-c53a9d29495e`.
116
117
117
118
## How to check the status of a reindex job
118
119
119
-
Once you’ve started a reindex job, you can check the status of the job using the following call:
120
+
Once you start a reindex job, you can check the status of the job using the following call.
The following information is shown in the above response:
198
+
The following information is shown in the preceding response:
198
199
199
200
*`totalResourcesToReindex`: Includes the total number of resources that are being reindexed in this job.
200
201
@@ -206,19 +207,19 @@ The following information is shown in the above response:
206
207
207
208
*`resources`: Lists all the resource types impacted by the reindex job.
208
209
209
-
* 'resourceReindexProgressByResource (CountReindexed of Count)': Provides reindexed count of the total count, per resource type. In cases where reindexing for a specific resource type is queued, only Count is provided.
210
+
* 'resourceReindexProgressByResource (CountReindexed of Count)': Provides a reindexed count of the total count, per resource type. In cases where reindexing for a specific resource type is queued, only Count is provided.
210
211
211
212
* 'searchParams': Lists url of the search parameters impacted by the reindex job.
212
213
213
214
## Delete a reindex job
214
215
215
-
If you need to cancel a reindex job, use a `DELETE` call and specify the reindex job ID:
216
+
If you need to cancel a reindex job, use a `DELETE` call and specify the reindex job ID.
A reindex job can be quite performance intensive. The FHIR service offers some throttling controls to help you manage how a reindex job run on your database.
222
+
A reindex job can be quite performance intensive. The FHIR service offers throttling controls to help manage how a reindex job runs on your database.
222
223
223
224
> [!NOTE]
224
225
> It is not uncommon on large datasets for a reindex job to run for days.
@@ -228,10 +229,10 @@ Below is a table outlining the available parameters, defaults, and recommended r
|`QueryDelayIntervalInMilliseconds`| The delay between each batch of resources being kicked off during the reindex job. A smaller number speeds up the job while a larger number slows it down. | 500 MS (.5 seconds) | 50 to 500000 |
231
-
|`MaximumResourcesPerQuery`| The maximum number of resources included in the batch of resources to be reindexed. | 100 | 1-5000 |
232
+
|`MaximumResourcesPerQuery`| The maximum number of resources included in the batch to be reindexed. | 100 | 1-5000 |
232
233
|`MaximumConcurrency`| The number of batches done at a time. | 1 | 1-10 |
233
234
234
-
If you want to use any of the parameters above, you can pass them into the `Parameters` resource when you send the initial `POST` request to start a reindex job.
235
+
If you want to use any of the preceding parameters, you can pass them into the `Parameters` resource when you send the initial `POST` request to start a reindex job.
235
236
236
237
```json
237
238
@@ -262,4 +263,4 @@ In this article, you've learned how to perform a reindex job in your FHIR servic
0 commit comments