-
Notifications
You must be signed in to change notification settings - Fork 29
/
DeployFhirPipelineToContainerApp.json
450 lines (450 loc) · 18.1 KB
/
DeployFhirPipelineToContainerApp.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string",
"defaultValue": "East US",
"allowedValues": [
"Australia East",
"Brazil South",
"Canada Central",
"Central US",
"East Asia",
"East US",
"East US 2",
"France Central",
"Germany West Central",
"Japan East",
"Korea Central",
"North Central US",
"North Europe",
"Norway East",
"South Africa North",
"South Central US",
"UK South",
"West Europe",
"West US",
"West US 3"
],
"metadata": {
"description": "Location for all resources."
}
},
"pipelineName": {
"type": "string",
"minLength": 3,
"maxLength": 24,
"metadata": {
"description": "The name of the container app."
}
},
"containerAppEnvironmentName": {
"type": "string",
"defaultValue": "",
"maxLength": 24,
"metadata": {
"description": "The name of the existing Azure Container App environment. If not specified, new environment will be created."
}
},
"fhirServerUrl": {
"type": "string",
"metadata": {
"description": "The fhir server endpoint to get data."
}
},
"authentication": {
"type": "bool",
"defaultValue": false,
"allowedValues": [
true,
false
],
"metadata": {
"description": "Whether to access Azure API for FHIR with managed identity authentication. Set it false if you use an OSS public FHIR server instance."
}
},
"fhirVersion": {
"type": "string",
"defaultValue": "R4",
"allowedValues": ["R4"]
},
"dataStart": {
"type": "string",
"defaultValue": "1970-01-01 00:00:00 +00:00",
"metadata": {
"description": "Start timestamp of the data range to export."
}
},
"dataEnd": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "End timestamp of the data range to export. If not specified, all data will be exported."
}
},
"containerName": {
"type": "string",
"defaultValue": "fhir",
"metadata": {
"description": "The name of the container to store job and data."
}
},
"jobConcurrency": {
"type": "int",
"defaultValue": 3,
"minValue": 2,
"maxValue": 10,
"metadata": {
"description": "Count of concurrent jobs executing in parallel."
}
},
"schedulerInterval": {
"type": "string",
"defaultValue": "every 5 minutes",
"allowedValues": [
"every 5 minutes",
"every 30 minutes",
"every hour",
"every day",
"customized"
],
"metadata": {
"description": "The scheduler interval. To customize the scheduler, set the value to \"customized\" and specify the value in Scheduler Crontab Expression below."
}
},
"schedulerCrontabExpression": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "Use a crontab expression to set the scheduler. A crontab expression is a six-part crontab format (sec min hour day month day-of-week). Refer to https://github.com/atifaziz/NCrontab for more about crontab expression."
}
},
"customizedSchemaImageReference":{
"type": "string",
"defaultValue": "",
"metadata": {
"description": "The customized schema image reference for the image on Container Registry. Refer to https://github.com/microsoft/FHIR-Converter/blob/main/docs/TemplateManagementCLI.md for manage your template images."
}
},
"filterConfigImageReference":{
"type": "string",
"defaultValue": "",
"metadata": {
"description": "Azure Container Registry image reference of filter configuration file."
}
},
"filterScope":{
"type": "string",
"defaultValue": "System",
"metadata": {
"description": "For data filtering use. The export scope can be System or Group. The default value is System if no filter is applied."
}
},
"groupId":{
"type": "string",
"defaultValue": "",
"metadata": {
"description": "For data filtering use. If the Filter scope is set as Group, you need to fill the group Id, otherwise leave it blank."
}
},
"requiredTypes":{
"type": "string",
"defaultValue": "",
"metadata": {
"description": "For data filtering use. Specify which types of resources will be included. For example, type=Patient would return only patient resources. All resource types will be exported if not specified. Leave it blank if no filter is applied."
}
},
"typeFilters":{
"type": "string",
"defaultValue": "",
"metadata": {
"description": "For data filtering use. Use along with the requiredTypes configuration. The value is a comma-separated list of FHIR queries that further restrict the results. All data of requiredTypes will be exported if not specified. Leave it blank if no filter is applied."
}
},
"image": {
"type": "string",
"defaultValue": "healthplatformregistry.azurecr.io/healthdatatodatalaketool:v0.6.2.1",
"metadata": {
"description": "Container image to deploy. Should be of the form repoName/imagename:tag for images stored in public Docker Hub, or a fully qualified URI for other registries. Images from private registries require additional registry credentials."
}
},
"maxInstanceCount": {
"type": "int",
"defaultValue": 10,
"minValue": 1,
"maxValue": 30,
"metadata": {
"description": "Maximum number of replicas running for fhir to datalake container app."
}
},
"storageAccountType": {
"type": "string",
"defaultValue": "Standard_LRS",
"allowedValues": [
"Standard_LRS",
"Standard_GRS",
"Standard_RAGRS"
],
"metadata": {
"description": "Storage Account type"
}
}
},
"variables": {
"pipelineContainerName": "fhir-to-datalake",
"pipelineName": "[toLower(parameters('pipelineName'))]",
"analyticsWorkspaceName": "[concat(variables('pipelineName'), '-LogAnalytics')]",
"environmentName": "[if(empty(parameters('containerAppEnvironmentName')), concat(variables('pipelineName'), '-Environment') ,parameters('containerAppEnvironmentName'))]",
"jobInfoQueueName": "[concat(variables('pipelineName'), 'jobinfoqueue')]",
"jobInfoTableName": "[concat(variables('pipelineName'), 'jobinfotable')]",
"metadataTableName": "[concat(variables('pipelineName'), 'metadatatable')]",
"resourceTags": {"FhirAnalyticsPipeline": "FhirToDataLake", "FhirSchemaVersion": "v0.6.2"},
"storageAccountName": "[concat(substring(replace(variables('pipelineName'), '-', ''), 0, min(11, length(replace(variables('pipelineName'), '-', '')))), uniquestring(resourceGroup().id, variables('pipelineName')))]",
"storageBlobDataContributerRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe')]",
"storageQueueDataContributerRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', '974c5e8b-45b9-4653-ba55-5f855dd0fb88')]",
"storageTableDataContributerRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', '0a9a7e1f-b9d0-4cc4-a60d-0319b160aaa3')]",
"filterConfigImageReference": "[toLower(parameters('filterConfigImageReference'))]",
"customizedSchemaImageReference": "[toLower(parameters('customizedSchemaImageReference'))]",
"schedulerCronExpression": "[if(equals(parameters('schedulerInterval'), 'every 5 minutes'), '0 */5 * * * *', if(equals(parameters('schedulerInterval'), 'every 30 minutes'), '0 */30 * * * *', if(equals(parameters('schedulerInterval'), 'every hour'), '0 0 * * * *', if(equals(parameters('schedulerInterval'), 'every day'), '0 0 0 * * *', parameters('schedulerCrontabExpression')))))]"
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2019-06-01",
"name": "[variables('storageAccountName')]",
"location": "[parameters('location')]",
"tags": "[variables('resourceTags')]",
"sku": {
"name": "[parameters('storageAccountType')]"
},
"properties": {
"isHnsEnabled": true
},
"kind": "StorageV2"
},
{
"type": "Microsoft.OperationalInsights/workspaces",
"apiVersion": "2021-12-01-preview",
"name": "[variables('analyticsWorkspaceName')]",
"location": "[parameters('location')]",
"tags": "[variables('resourceTags')]",
"properties": {
"sku": {
"name": "PerGB2018"
},
"retentionInDays": 60
}
},
{
"type": "Microsoft.App/managedEnvironments",
"apiVersion": "2022-03-01",
"name": "[variables('environmentName')]",
"dependsOn": [
"[resourceId('Microsoft.OperationalInsights/workspaces', variables('analyticsWorkspaceName'))]"
],
"location": "[parameters('location')]",
"tags": "[variables('resourceTags')]",
"properties": {
"appLogsConfiguration": {
"destination": "log-analytics",
"logAnalyticsConfiguration": {
"customerId": "[reference(resourceId('Microsoft.OperationalInsights/workspaces/', variables('analyticsWorkspaceName')), '2015-03-20').customerId]",
"sharedKey": "[listKeys(resourceId('Microsoft.OperationalInsights/workspaces/', variables('analyticsWorkspaceName')), '2015-03-20').primarySharedKey]"
}
}
}
},
{
"apiVersion": "2022-03-01",
"type": "Microsoft.App/containerApps",
"name": "[variables('pipelineName')]",
"dependsOn": [
"[resourceId('Microsoft.App/managedEnvironments', variables('environmentName'))]"
],
"identity": {
"type": "SystemAssigned"
},
"location": "[parameters('location')]",
"tags": "[variables('resourceTags')]",
"properties": {
"managedEnvironmentId": "[resourceId('Microsoft.App/managedEnvironments', variables('environmentName'))]",
"template": {
"revisionSuffix": "myrevision",
"containers": [
{
"name": "[variables('pipelineContainerName')]",
"image": "[parameters('image')]",
"env": [
{
"name": "configVersion",
"value": "1"
},
{
"name": "job__jobInfoQueueName",
"value": "[variables('jobInfoQueueName')]"
},
{
"name": "job__jobInfoTableName",
"value": "[variables('jobInfoTableName')]"
},
{
"name": "job__metadataTableName",
"value": "[variables('metadataTableName')]"
},
{
"name": "job__maxRunningJobCount",
"value": "[string(parameters('jobConcurrency'))]"
},
{
"name": "job__containerName",
"value": "[parameters('containerName')]"
},
{
"name": "job__startTime",
"value": "[parameters('dataStart')]"
},
{
"name": "job__endTime",
"value": "[parameters('dataEnd')]"
},
{
"name": "job__tableUrl",
"value": "[concat('https://', variables('storageAccountName'), '.table.core.windows.net')]"
},
{
"name": "job__queueUrl",
"value": "[concat('https://', variables('storageAccountName'), '.queue.core.windows.net')]"
},
{
"name": "job__schedulerCronExpression",
"value": "[variables('schedulerCronExpression')]"
},
{
"name": "dataLakeStore__storageUrl",
"value": "[concat('https://', variables('storageAccountName'), '.blob.core.windows.net')]"
},
{
"name": "filter__filterScope",
"value": "[parameters('filterScope')]"
},
{
"name": "filter__enableExternalFilter",
"value": "[if(empty(variables('filterConfigImageReference')), 'false', 'true')]"
},
{
"name": "filter__filterImageReference",
"value": "[variables('filterConfigImageReference')]"
},
{
"name": "filter__groupId",
"value": "[parameters('groupId')]"
},
{
"name": "filter__requiredTypes",
"value": "[parameters('requiredTypes')]"
},
{
"name": "filter__typeFilters",
"value": "[parameters('typeFilters')]"
},
{
"name": "schema__enableCustomizedSchema",
"value": "[if(empty(variables('customizedSchemaImageReference')), 'false', 'true')]"
},
{
"name": "schema__schemaImageReference",
"value": "[variables('customizedSchemaImageReference')]"
},
{
"name": "fhirServer__serverUrl",
"value": "[parameters('fhirServerUrl')]"
},
{
"name": "fhirServer__version",
"value": "[parameters('fhirVersion')]"
},
{
"name": "fhirServer__authentication",
"value": "[if(parameters('authentication'), 'ManagedIdentity', 'None')]"
}
],
"resources": {
"cpu": 2,
"memory": "4Gi"
}
}
],
"scale": {
"minReplicas": 1,
"maxReplicas": "[parameters('maxInstanceCount')]",
"rules": [
{
"name": "cpu-scaling-rule",
"custom": {
"type": "cpu",
"metadata": {
"type": "Utilization",
"value": "50"
}
}
},
{
"name": "memory-scaling-rule",
"custom": {
"type": "memory",
"metadata": {
"type": "Utilization",
"value": "50"
}
}
}
]
}
}
}
},
{
"type": "Microsoft.Storage/storageAccounts/providers/roleAssignments",
"apiVersion": "2018-09-01-preview",
"name": "[concat(variables('storageAccountName'), '/Microsoft.Authorization/', guid(uniqueString(variables('storageAccountName'), variables('pipelineName'), 'blob')))]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]",
"[resourceId('Microsoft.App/containerApps', variables('pipelineName'))]"
],
"properties": {
"roleDefinitionId": "[variables('storageBlobDataContributerRoleId')]",
"principalId": "[reference(resourceId('Microsoft.App/containerApps/', variables('pipelineName')), '2022-03-01', 'Full').identity.principalId]",
"principalType": "ServicePrincipal"
}
},
{
"type": "Microsoft.Storage/storageAccounts/providers/roleAssignments",
"apiVersion": "2018-09-01-preview",
"name": "[concat(variables('storageAccountName'), '/Microsoft.Authorization/', guid(uniqueString(variables('storageAccountName'), variables('pipelineName'), 'queue')))]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]",
"[resourceId('Microsoft.App/containerApps', variables('pipelineName'))]"
],
"properties": {
"roleDefinitionId": "[variables('storageQueueDataContributerRoleId')]",
"principalId": "[reference(resourceId('Microsoft.App/containerApps/', variables('pipelineName')), '2022-03-01', 'Full').identity.principalId]",
"principalType": "ServicePrincipal"
}
},
{
"type": "Microsoft.Storage/storageAccounts/providers/roleAssignments",
"apiVersion": "2018-09-01-preview",
"name": "[concat(variables('storageAccountName'), '/Microsoft.Authorization/', guid(uniqueString(variables('storageAccountName'), variables('pipelineName'), 'table')))]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]",
"[resourceId('Microsoft.App/containerApps', variables('pipelineName'))]"
],
"properties": {
"roleDefinitionId": "[variables('storageTableDataContributerRoleId')]",
"principalId": "[reference(resourceId('Microsoft.App/containerApps/', variables('pipelineName')), '2022-03-01', 'Full').identity.principalId]",
"principalType": "ServicePrincipal"
}
}
]
}