Skip to content

Commit 9b5c077

Browse files
authored
Merge pull request #1882 from IBM/issue-1880
Signed-off-by: Lee Surprenant <[email protected]>
2 parents 85a4159 + 201d6dc commit 9b5c077

File tree

21 files changed

+326
-190
lines changed

21 files changed

+326
-190
lines changed

docs/src/pages/guides/FHIRServerUsersGuide.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ layout: post
33
title: IBM FHIR Server User's Guide
44
description: IBM FHIR Server User's Guide
55
Copyright: years 2017, 2021
6-
lastupdated: "2021-01-21"
6+
lastupdated: "2021-02-22"
77
permalink: /FHIRServerUsersGuide/
88
---
99

@@ -2223,6 +2223,7 @@ This section contains reference information about each of the configuration prop
22232223
|`fhirServer/bulkdata/patientExportPageSize`|int| The search page size for patient/group export, the default value is 200 |
22242224
|`fhirServer/bulkdata/useFhirServerTrustStore`|boolean| If the COS Client should use the IBM FHIR Server's TrustStore to access S3/IBMCOS service |
22252225
|`fhirServer/bulkdata/enableParquet`|boolean| Whether or not the server is configured to support export to parquet; to properly enable it the administrator must first make spark and stocator available to the fhir-bulkimportexport-webapp (e.g through the shared lib at `wlp/user/shared/resources/lib`) |
2226+
|`fhirServer/bulkdata/ignoreImportOutcomes`|boolean| Control if push OperationOutcomes to COS/S3. |
22262227

22272228
### 5.1.2 Default property values
22282229
| Property Name | Default value |
@@ -2301,6 +2302,7 @@ This section contains reference information about each of the configuration prop
23012302
|`fhirServer/bulkdata/patientExportPageSize`|200|
23022303
|`fhirServer/bulkdata/useFhirServerTrustStore`|false|
23032304
|`fhirServer/bulkdata/enableParquet`|false|
2305+
|`fhirServer/bulkdata/ignoreImportOutcomes`|false|
23042306

23052307
### 5.1.3 Property attributes
23062308
Depending on the context of their use, config properties can be:
@@ -2400,6 +2402,7 @@ must restart the server for that change to take effect.
24002402
|`fhirServer/bulkdata/patientExportPageSize`|Y|Y|
24012403
|`fhirServer/bulkdata/useFhirServerTrustStore`|Y|Y|
24022404
|`fhirServer/bulkdata/enableParquet`|Y|Y|
2405+
|`fhirServer/bulkdata/ignoreImportOutcomes`|Y|Y|
24032406

24042407
## 5.2 Keystores, truststores, and the FHIR server
24052408

fhir-bulkimportexport-webapp/src/main/java/META-INF/batch-jobs/FhirBulkImportChunkJob.xml

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
<property name="cos.credential.ibm" value="#{jobParameters['cos.credential.ibm']}"/>
4343
<property name="cos.operationoutcomes.bucket.name" value="#{jobParameters['cos.operationoutcomes.bucket.name']}"/>
4444
<property name="import.fhir.validation" value="#{jobParameters['import.fhir.validation']}"/>
45+
<property name="incomingUrl" value="#{jobParameters['incomingUrl']}"/>
4546
</properties>
4647
</writer>
4748
</chunk>

fhir-bulkimportexport-webapp/src/main/java/com/ibm/fhir/jbatch/bulkdata/common/Constants.java

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
/*
2-
* (C) Copyright IBM Corp. 2019, 2020
2+
* (C) Copyright IBM Corp. 2019, 2021
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

77
package com.ibm.fhir.jbatch.bulkdata.common;
88

99
/**
10-
* Constants for BulkExportImport.
11-
*
10+
* Constants for BulkExportImport
1211
*/
1312
public class Constants {
1413
public static final String DEFAULT_FHIR_TENANT = "default";
@@ -85,8 +84,6 @@ public class Constants {
8584
public static final String IMPORT_PARTITTION_WORKITEM = "import.partition.workitem";
8685
public static final String PARTITION_RESOURCE_TYPE = "partition.resourcetype";
8786

88-
// Control if push OperationOutcomes to COS/S3.
89-
public static final boolean IMPORT_IS_COLLECT_OPERATIONOUTCOMES = true;
9087
// Retry times when https or amazon s3 client timeout or other error happens, e.g, timeout can happen if the batch write to DB takes
9188
// longer than the socket timeout, set to retry once for now.
9289
public static final int IMPORT_RETRY_TIMES = 1;

fhir-bulkimportexport-webapp/src/main/java/com/ibm/fhir/jbatch/bulkdata/load/ChunkReader.java

+37-28
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
/*
2-
* (C) Copyright IBM Corp. 2019, 2020
2+
* (C) Copyright IBM Corp. 2019, 2021
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

77
package com.ibm.fhir.jbatch.bulkdata.load;
88

9+
import static com.ibm.fhir.jbatch.bulkdata.common.Constants.COS_API_KEY;
10+
import static com.ibm.fhir.jbatch.bulkdata.common.Constants.COS_BUCKET_NAME;
11+
import static com.ibm.fhir.jbatch.bulkdata.common.Constants.COS_ENDPOINT_URL;
12+
import static com.ibm.fhir.jbatch.bulkdata.common.Constants.COS_IS_IBM_CREDENTIAL;
13+
import static com.ibm.fhir.jbatch.bulkdata.common.Constants.COS_LOCATION;
14+
import static com.ibm.fhir.jbatch.bulkdata.common.Constants.COS_SRVINST_ID;
15+
import static com.ibm.fhir.jbatch.bulkdata.common.Constants.DEFAULT_FHIR_TENANT;
16+
import static com.ibm.fhir.jbatch.bulkdata.common.Constants.FHIR_DATASTORE_ID;
17+
import static com.ibm.fhir.jbatch.bulkdata.common.Constants.FHIR_TENANT;
18+
import static com.ibm.fhir.jbatch.bulkdata.common.Constants.IMPORT_FHIR_STORAGE_TYPE;
19+
import static com.ibm.fhir.jbatch.bulkdata.common.Constants.IMPORT_PARTITTION_WORKITEM;
20+
import static com.ibm.fhir.jbatch.bulkdata.common.Constants.PARTITION_RESOURCE_TYPE;
21+
922
import java.io.Serializable;
1023
import java.util.ArrayList;
1124
import java.util.List;
@@ -24,18 +37,14 @@
2437
import com.ibm.fhir.config.FHIRConfiguration;
2538
import com.ibm.fhir.config.FHIRRequestContext;
2639
import com.ibm.fhir.jbatch.bulkdata.common.BulkDataUtils;
27-
import com.ibm.fhir.jbatch.bulkdata.common.Constants;
2840
import com.ibm.fhir.model.resource.Resource;
2941

3042
/**
31-
* Bulk import Chunk implementation - the Reader.
32-
*
43+
* BulkData Import - ChunkReader
3344
*/
3445
@Dependent
3546
public class ChunkReader extends AbstractItemReader {
3647
private static final Logger logger = Logger.getLogger(ChunkReader.class.getName());
37-
private AmazonS3 cosClient = null;
38-
private int numOfLinesToSkip = 0;
3948

4049
@Inject
4150
StepContext stepCtx;
@@ -44,79 +53,82 @@ public class ChunkReader extends AbstractItemReader {
4453
* The data source storage type.
4554
*/
4655
@Inject
47-
@BatchProperty(name = Constants.IMPORT_FHIR_STORAGE_TYPE)
56+
@BatchProperty(name = IMPORT_FHIR_STORAGE_TYPE)
4857
String dataSourceStorageType;
4958

5059
/**
5160
* The IBM COS API key or S3 access key.
5261
*/
5362
@Inject
54-
@BatchProperty(name = Constants.COS_API_KEY)
63+
@BatchProperty(name = COS_API_KEY)
5564
String cosApiKeyProperty;
5665

5766
/**
5867
* The IBM COS service instance id or S3 secret key.
5968
*/
6069
@Inject
61-
@BatchProperty(name = Constants.COS_SRVINST_ID)
70+
@BatchProperty(name = COS_SRVINST_ID)
6271
String cosSrvinstId;
6372

6473
/**
6574
* The IBM COS or S3 End point URL.
6675
*/
6776
@Inject
68-
@BatchProperty(name = Constants.COS_ENDPOINT_URL)
77+
@BatchProperty(name = COS_ENDPOINT_URL)
6978
String cosEndpointUrl;
7079

7180
/**
7281
* The IBM COS or S3 location.
7382
*/
7483
@Inject
75-
@BatchProperty(name = Constants.COS_LOCATION)
84+
@BatchProperty(name = COS_LOCATION)
7685
String cosLocation;
7786

7887
/**
7988
* The IBM COS or S3 bucket name to import from.
8089
*/
8190
@Inject
82-
@BatchProperty(name = Constants.COS_BUCKET_NAME)
91+
@BatchProperty(name = COS_BUCKET_NAME)
8392
String cosBucketName;
8493

8594
/**
8695
* If use IBM credential or S3 secret keys.
8796
*/
8897
@Inject
89-
@BatchProperty(name = Constants.COS_IS_IBM_CREDENTIAL)
98+
@BatchProperty(name = COS_IS_IBM_CREDENTIAL)
9099
String cosCredentialIbm;
91100

92101
/**
93102
* Work item to process.
94103
*/
95104
@Inject
96-
@BatchProperty(name = Constants.IMPORT_PARTITTION_WORKITEM)
105+
@BatchProperty(name = IMPORT_PARTITTION_WORKITEM)
97106
String importPartitionWorkitem;
98107

99108
/**
100-
* Fhir resource type to process.
109+
* Resource type to process.
101110
*/
102111
@Inject
103-
@BatchProperty(name = Constants.PARTITION_RESOURCE_TYPE)
112+
@BatchProperty(name = PARTITION_RESOURCE_TYPE)
104113
String importPartitionResourceType;
105-
114+
106115
/**
107-
* Fhir tenant id.
116+
* Tenant id.
108117
*/
109118
@Inject
110-
@BatchProperty(name = Constants.FHIR_TENANT)
119+
@BatchProperty(name = FHIR_TENANT)
111120
String fhirTenant;
112121

113122
/**
114-
* Fhir data store id.
123+
* Data store id.
115124
*/
116125
@Inject
117-
@BatchProperty(name = Constants.FHIR_DATASTORE_ID)
126+
@BatchProperty(name = FHIR_DATASTORE_ID)
118127
String fhirDatastoreId;
119128

129+
private AmazonS3 cosClient = null;
130+
private int numOfLinesToSkip = 0;
131+
120132
public ChunkReader() {
121133
super();
122134
}
@@ -127,7 +139,7 @@ public Object readItem() throws Exception {
127139
if (!stepCtx.getBatchStatus().equals(BatchStatus.STARTED)) {
128140
return null;
129141
}
130-
List<Resource> loadedFhirResources = new ArrayList<Resource>();
142+
List<Resource> loadedFhirResources = new ArrayList<>();
131143
if (logger.isLoggable(Level.FINE)) {
132144
logger.fine("readItem: get work item:" + importPartitionWorkitem + " resource type: " + importPartitionResourceType);
133145
}
@@ -179,7 +191,7 @@ public void open(Serializable checkpoint) throws Exception {
179191
logger.info("open: Set tenant to default!");
180192
}
181193
if (fhirDatastoreId == null) {
182-
fhirDatastoreId = Constants.DEFAULT_FHIR_TENANT;
194+
fhirDatastoreId = DEFAULT_FHIR_TENANT;
183195
logger.info("open: Set DatastoreId to default!");
184196
}
185197

@@ -236,18 +248,15 @@ public void open(Serializable checkpoint) throws Exception {
236248
chunkData.setInFlyRateBeginMilliSeconds(System.currentTimeMillis());
237249
stepCtx.setTransientUserData(chunkData);
238250
}
239-
240-
241251
}
242252

243253
@Override
244254
public void close() throws Exception {
245-
255+
// No Operation
246256
}
247257

248258
@Override
249259
public Serializable checkpointInfo() throws Exception {
250260
return ImportCheckPointData.fromImportTransientUserData((ImportTransientUserData)stepCtx.getTransientUserData());
251261
}
252-
253-
}
262+
}

0 commit comments

Comments
 (0)