Skip to content

Commit 40d87b4

Browse files
committed
switch to using the small test dataset
1 parent 54721bc commit 40d87b4

File tree

7 files changed

+28
-16
lines changed

7 files changed

+28
-16
lines changed

docker/README.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,25 @@ image is based on the HAPI FHIR
1717
[Synthea](https://synthea.mitre.org/downloads) stored in the container itself.
1818
To load this dataset into the HAPI FHIR image, do the following:
1919

20-
1. Run a local version of the HAPI FHIR server:
20+
1. Run a local version of the HAPI FHIR server. Note by default this uses an
21+
in-memory database but we want to persist the uploaded data, hence we change
22+
the configuration by the following environment variables:
2123

2224
```
23-
docker run --rm -d -p 8080:8080 --name hapi_fhir hapiproject/hapi:latest
25+
docker run --rm -d -p 8080:8080 --name hapi-fhir-add-synthea \
26+
-e spring.datasource.url='jdbc:h2:file:/app/data/hapi_db;DB_CLOSE_ON_EXIT=FALSE;AUTO_RECONNECT=TRUE' \
27+
-e spring.jpa.hibernate.ddl-auto=update \
28+
hapiproject/hapi:latest
2429
```
2530

26-
2. Download the `1K Sample Synthetic Patient Records, FHIR R4` dataset:
31+
2. Download the `1K+ Sample Synthetic Patient Records, FHIR R4` dataset:
2732

2833
```
2934
wget https://synthetichealth.github.io/synthea-sample-data/downloads/synthea_sample_data_fhir_r4_sep2019.zip \
3035
-O fhir.zip
3136
```
3237

33-
3. Unzip the file, a directory named `fhir` should be created containig JSON
38+
3. Unzip the file, a directory named `fhir` should be created containing JSON
3439
files:
3540

3641
```
@@ -39,8 +44,15 @@ To load this dataset into the HAPI FHIR image, do the following:
3944

4045
4. Use the Synthetic Data Uploader from the
4146
[FHIR Analytics](https://github.com/GoogleCloudPlatform/openmrs-fhir-analytics/tree/master/synthea-hiv)
42-
repo to upload the files into the HAPI FHIR container
43-
`docker run -it --network=host \ -e SINK_TYPE="HAPI" \ -e FHIR_ENDPOINT=http://localhost:8080/fhir \ -e INPUT_DIR="/workspace/output/fhir" \ -e CORES="--cores 1" \ -v $(pwd)/fhir:/workspace/output/fhir \ us-docker.pkg.dev/cloud-build-fhir/fhir-analytics/synthea-uploader:latest`
47+
repo to upload the files into the HAPI FHIR container. Note instead of
48+
uploading all patients, you can pick a small subset instead. In that case
49+
adjust the `INPUT_DIR` accordingly. Using the whole dataset increases the
50+
container init time by a few minutes (and slows down e2e tests which depend
51+
on this):
52+
53+
```
54+
docker run -it --network=host \ -e SINK_TYPE="HAPI" \ -e FHIR_ENDPOINT=http://localhost:8080/fhir \ -e INPUT_DIR="/workspace/output/fhir" \ -e CORES="--cores 1" \ -v $(pwd)/fhir:/workspace/output/fhir \ us-docker.pkg.dev/cloud-build-fhir/fhir-analytics/synthea-uploader:latest
55+
```
4456

4557
5. As the uploader uses `POST` to upload the JSON files, the server will create
4658
the ID used to refer to resources. We would like to upload a patient list
@@ -82,7 +94,7 @@ To load this dataset into the HAPI FHIR image, do the following:
8294
7. Commit the Docker container. This saves its state into a new image
8395

8496
```
85-
docker commit hapi_fhir us-docker.pkg.dev/fhir-proxy-build/stable/hapi-synthea:latest
97+
docker commit hapi-fhir-add-synthea us-docker.pkg.dev/fhir-proxy-build/stable/hapi-synthea:latest
8698
```
8799

88100
8. Push the image

docker/hapi-proxy-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ services:
5555
timeout: 10s
5656

5757
hapi-server:
58-
image: us-docker.pkg.dev/fhir-proxy-build/stable/hapi-synthea:latest
58+
image: us-docker.pkg.dev/fhir-proxy-build/stable/hapi-synthea:small
5959
ports:
6060
- "8099:8080"

e2e-test/e2e.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ def _assert_audit_events(expected_audit_event: Dict[str, Any],
292292
if __name__ == "__main__":
293293
logging.basicConfig(level=logging.INFO)
294294

295-
patients = ["Patient/75270", "Patient/3810"]
295+
patients = ["Patient/3177", "Patient/2835"]
296296
resources = [("Encounter", "patient"), ("Observation", "subject")]
297297
auth_client = clients.AuthClient()
298298
fhir_proxy_client = clients.FhirProxyClient()
@@ -306,7 +306,7 @@ def _assert_audit_events(expected_audit_event: Dict[str, Any],
306306
test_post_resource_increase_count(
307307
("Observation", "subject"),
308308
"e2e-test/obs.json",
309-
"Patient/75270",
309+
"Patient/3177",
310310
hapi_client,
311311
fhir_proxy_client,
312312
auth_client,

e2e-test/obs.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
"text": "Body Weight"
2424
},
2525
"subject": {
26-
"reference": "Patient/75270"
26+
"reference": "Patient/3177"
2727
},
2828
"encounter": {
29-
"reference": "Encounter/76366"
29+
"reference": "Encounter/3186"
3030
},
3131
"effectiveDateTime": "2015-07-05T10:11:41-04:00",
3232
"issued": "2015-07-05T10:11:41.981-04:00",

e2e-test/observation_audit_events.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
},
136136
{
137137
"what": {
138-
"reference": "Patient/75270"
138+
"reference": "Patient/3177"
139139
},
140140
"type": {
141141
"system": "http://terminology.hl7.org/CodeSystem/audit-entity-type",

e2e-test/transaction_bundle.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{
66
"request": {
77
"method": "GET",
8-
"url": "Observation?_count=1&subject=Patient/75270"
8+
"url": "Observation?_count=1&subject=Patient/3177"
99
}
1010
},
1111
{

e2e-test/transaction_bundle_audit_events.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@
301301
},
302302
{
303303
"what": {
304-
"reference": "Patient/75270"
304+
"reference": "Patient/3177"
305305
},
306306
"type": {
307307
"system": "http://terminology.hl7.org/CodeSystem/audit-entity-type",
@@ -340,7 +340,7 @@
340340
"code": "24",
341341
"display": "Query"
342342
},
343-
"description": "GET http://localhost:8080/fhir/Observation?_count=1&subject=Patient/75270",
343+
"description": "GET http://localhost:8080/fhir/Observation?_count=1&subject=Patient/3177",
344344
"query": "aHR0cDovL2xvY2FsaG9zdDo4MDgwL2ZoaXIvT2JzZXJ2YXRpb24/X2NvdW50PTEmc3ViamVjdD1QYXRpZW50JTJGNzUyNzA="
345345
}
346346
]

0 commit comments

Comments
 (0)