Skip to content

Commit e4d1c3d

Browse files
committed
Support FHIR R6
Closes: #2892
1 parent 1a77977 commit e4d1c3d

File tree

129 files changed

+1386
-557848
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+1386
-557848
lines changed

.github/scripts/check-capability-statement.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ test "status" "$(echo "$CAPABILITY_STATEMENT" | jq -r .status)" "active"
1010
test "kind" "$(echo "$CAPABILITY_STATEMENT" | jq -r .kind)" "instance"
1111
test "software name" "$(echo "$CAPABILITY_STATEMENT" | jq -r .software.name)" "Blaze"
1212
test "URL" "$(echo "$CAPABILITY_STATEMENT" | jq -r .implementation.url)" "http://localhost:8080/fhir"
13-
test "FHIR version" "$(echo "$CAPABILITY_STATEMENT" | jq -r .fhirVersion)" "4.0.1"
13+
test "FHIR version" "$(echo "$CAPABILITY_STATEMENT" | jq -r .fhirVersion)" "6.0.0-ballot3"
1414
test "format" "$(echo "$CAPABILITY_STATEMENT" | jq -r '.format | join(",")')" "application/fhir+json,application/fhir+xml"
1515

1616
test "Patient Profile" "$(echo "$CAPABILITY_STATEMENT" | jq -r '.rest[0].resource[] | select(.type == "Patient") .profile')" "http://hl7.org/fhir/StructureDefinition/Patient"

.github/scripts/check-resource-totals.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,13 @@ EXPECTED_TOTALS="$(cat <<END
1111
"CareTeam",540
1212
"Claim",9856
1313
"Condition",1597
14-
"Device",28
1514
"DiagnosticReport",8229
1615
"DocumentReference",4769
1716
"Encounter",4769
1817
"ExplanationOfBenefit",4769
19-
"ImagingStudy",145
2018
"Immunization",1616
2119
"Location",194
2220
"Medication",326
23-
"MedicationAdministration",326
2421
"MedicationRequest",5087
2522
"Observation",42929
2623
"Organization",194
@@ -29,7 +26,7 @@ EXPECTED_TOTALS="$(cat <<END
2926
"PractitionerRole",195
3027
"Procedure",3608
3128
"Provenance",120
32-
"StructureDefinition",185
29+
"StructureDefinition",204
3330
"SupplyDelivery",1886
3431
END
3532
)"

.github/workflows/build.yml

Lines changed: 92 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ jobs:
124124
- operation-compact
125125
- operation-graph
126126
- operation-graphql
127-
- operation-measure-evaluate-measure
128127
- operation-patient-everything
129128
- operation-patient-purge
130129
- operation-totals
@@ -534,6 +533,18 @@ jobs:
534533
- name: Run Blaze
535534
run: docker run --name blaze -d -e JAVA_TOOL_OPTIONS=-Xmx2g -e ENABLE_ADMIN_API=true -e CQL_EXPR_CACHE_SIZE=1000 -p 8080:8080 -p 8081:8081 -v blaze-data:/app/data blaze:latest
536535

536+
- name: Download Synthea Test Data
537+
uses: ./.github/actions/speicherwolke-download
538+
with:
539+
token: b3jf9dsbbJD554E
540+
filename: synthea-r6-100.tar
541+
542+
- name: Create Synthea Test Data Dir
543+
run: mkdir test-data-synthea-100
544+
545+
- name: Unpack Synthea Test Data
546+
run: tar -C test-data-synthea-100 -xf synthea-r6-100.tar
547+
537548
- name: Wait for Blaze
538549
run: .github/scripts/wait-for-url.sh http://localhost:8080/health
539550

@@ -547,7 +558,7 @@ jobs:
547558
run: .github/scripts/check-patient-last-change-index-state.sh current
548559

549560
- name: Load Data
550-
run: blazectl --no-progress --server http://localhost:8080/fhir upload .github/test-data/synthea
561+
run: blazectl --no-progress --server http://localhost:8080/fhir upload test-data-synthea-100
551562

552563
- name: Prometheus Metrics
553564
run: .github/scripts/test-cql-expr-cache-metrics.sh
@@ -723,6 +734,18 @@ jobs:
723734
run: docker compose -f .github/distributed-test/docker-compose.yml up -d
724735
if: ${{ matrix.variant == 'distributed' }}
725736

737+
- name: Download Synthea Test Data
738+
uses: ./.github/actions/speicherwolke-download
739+
with:
740+
token: b3jf9dsbbJD554E
741+
filename: synthea-r6-100.tar
742+
743+
- name: Create Synthea Test Data Dir
744+
run: mkdir test-data-synthea-100
745+
746+
- name: Unpack Synthea Test Data
747+
run: tar -C test-data-synthea-100 -xf synthea-r6-100.tar
748+
726749
- name: Wait for Blaze
727750
run: .github/scripts/wait-for-url.sh http://localhost:8080/health
728751
if: ${{ matrix.variant == 'standalone' }}
@@ -778,17 +801,14 @@ jobs:
778801
run: .github/scripts/check-resource-read-only.sh StructureDefinition "http://hl7.org/fhir/StructureDefinition/Patient"
779802

780803
- name: Load Data
781-
run: blazectl --no-progress --server http://localhost:8080/fhir upload .github/test-data/synthea
804+
run: blazectl --no-progress --server http://localhost:8080/fhir upload test-data-synthea-100
782805

783-
- name: Check Total-Number of Resources are 92299
784-
run: .github/scripts/check-total-number-of-resources.sh 92299
806+
- name: Check Total-Number of Resources are 91819
807+
run: .github/scripts/check-total-number-of-resources.sh 91819
785808

786809
- name: Check Resource Totals
787810
run: .github/scripts/check-resource-totals.sh
788811

789-
- name: Count Resources
790-
run: blazectl count-resources --server http://localhost:8080/fhir
791-
792812
- name: Download All Resources
793813
run: .github/scripts/download-all-resources.sh
794814

@@ -814,7 +834,7 @@ jobs:
814834
run: .github/scripts/check-summary-mode.sh Observation category
815835

816836
- name: Check that Encounter Resources don't contain Periods in Summary Mode
817-
run: .github/scripts/check-summary-mode.sh Encounter period
837+
run: .github/scripts/check-summary-mode.sh Encounter actualPeriod
818838

819839
- name: Download Observation Resources with special LOINC Codes
820840
run: .github/scripts/download-resources-query.sh Observation "code=http://loinc.org|10230-1,http://loinc.org|10480-2,http://loinc.org|10834-0,http://loinc.org|14804-9,http://loinc.org|14959-1,http://loinc.org|1742-6,http://loinc.org|1751-7,http://loinc.org|17861-6,http://loinc.org|18262-6,http://loinc.org|19123-9" 2399
@@ -1565,6 +1585,18 @@ jobs:
15651585
- name: Run Blaze
15661586
run: docker run --name blaze -d -e JAVA_TOOL_OPTIONS=-Xmx2g -e DB_BLOCK_CACHE_SIZE=512 -e ENABLE_OPERATION_PATIENT_PURGE=true -p 8080:8080 --read-only --tmpfs /tmp:exec -v blaze-data:/app/data blaze:latest
15671587

1588+
- name: Download Synthea Test Data
1589+
uses: ./.github/actions/speicherwolke-download
1590+
with:
1591+
token: b3jf9dsbbJD554E
1592+
filename: synthea-r6-100.tar
1593+
1594+
- name: Create Synthea Test Data Dir
1595+
run: mkdir test-data-synthea-100
1596+
1597+
- name: Unpack Synthea Test Data
1598+
run: tar -C test-data-synthea-100 -xf synthea-r6-100.tar
1599+
15681600
- name: Wait for Blaze
15691601
run: .github/scripts/wait-for-url.sh http://localhost:8080/health
15701602

@@ -1578,7 +1610,7 @@ jobs:
15781610
run: .github/scripts/check-referential-integrity-enforced.sh
15791611

15801612
- name: Load Data
1581-
run: blazectl --no-progress --server http://localhost:8080/fhir upload .github/test-data/synthea
1613+
run: blazectl --no-progress --server http://localhost:8080/fhir upload test-data-synthea-100
15821614

15831615
- name: Check Total-Number of Resources are 92299
15841616
run: .github/scripts/check-total-number-of-resources.sh 92299
@@ -1880,6 +1912,18 @@ jobs:
18801912
- name: Run Blaze
18811913
run: docker run --name blaze -d -e JAVA_TOOL_OPTIONS=-Xmx2g -e ENABLE_ADMIN_API=true -p 8080:8080 --read-only --tmpfs /tmp:exec -v blaze-data:/app/data blaze:latest
18821914

1915+
- name: Download Synthea Test Data
1916+
uses: ./.github/actions/speicherwolke-download
1917+
with:
1918+
token: b3jf9dsbbJD554E
1919+
filename: synthea-r6-100.tar
1920+
1921+
- name: Create Synthea Test Data Dir
1922+
run: mkdir test-data-synthea-100
1923+
1924+
- name: Unpack Synthea Test Data
1925+
run: tar -C test-data-synthea-100 -xf synthea-r6-100.tar
1926+
18831927
- name: Wait for Blaze
18841928
run: .github/scripts/wait-for-url.sh http://localhost:8080/health
18851929

@@ -1893,7 +1937,7 @@ jobs:
18931937
run: .github/scripts/admin-api/async-job.sh
18941938

18951939
- name: Load Data
1896-
run: blazectl --no-progress --server http://localhost:8080/fhir upload .github/test-data/synthea
1940+
run: blazectl --no-progress --server http://localhost:8080/fhir upload test-data-synthea-100
18971941

18981942
- name: Compact Unknown Database
18991943
run: .github/scripts/compact-unknown-database.sh
@@ -2007,6 +2051,18 @@ jobs:
20072051
- name: Run Blaze
20082052
run: docker run --name blaze -d -e JAVA_TOOL_OPTIONS=-Xmx2g -e FHIR_OPERATION_EVALUATE_MEASURE_TIMEOUT=10 -p 8080:8080 --read-only --tmpfs /tmp:exec -v blaze-data:/app/data blaze:latest
20092053

2054+
- name: Download Synthea Test Data
2055+
uses: ./.github/actions/speicherwolke-download
2056+
with:
2057+
token: b3jf9dsbbJD554E
2058+
filename: synthea-r6-100.tar
2059+
2060+
- name: Create Synthea Test Data Dir
2061+
run: mkdir test-data-synthea-100
2062+
2063+
- name: Unpack Synthea Test Data
2064+
run: tar -C test-data-synthea-100 -xf synthea-r6-100.tar
2065+
20102066
- name: Wait for Blaze
20112067
run: .github/scripts/wait-for-url.sh http://localhost:8080/health
20122068

@@ -2017,7 +2073,7 @@ jobs:
20172073
run: .github/scripts/check-capability-statement.sh
20182074

20192075
- name: Load Data
2020-
run: blazectl --no-progress --server http://localhost:8080/fhir upload .github/test-data/synthea
2076+
run: blazectl --no-progress --server http://localhost:8080/fhir upload test-data-synthea-100
20212077

20222078
- name: Evaluate CQL Query 1
20232079
run: .github/scripts/evaluate-measure-timeout.sh q1
@@ -2278,11 +2334,23 @@ jobs:
22782334
- name: Run Test Setup
22792335
run: docker compose -f docs/data-sync/copy/docker-compose.yml -f .github/doc-copy-data-test/docker-compose.override.yml up -d
22802336

2337+
- name: Download Synthea Test Data
2338+
uses: ./.github/actions/speicherwolke-download
2339+
with:
2340+
token: b3jf9dsbbJD554E
2341+
filename: synthea-r6-100.tar
2342+
2343+
- name: Create Synthea Test Data Dir
2344+
run: mkdir test-data-synthea-100
2345+
2346+
- name: Unpack Synthea Test Data
2347+
run: tar -C test-data-synthea-100 -xf synthea-r6-100.tar
2348+
22812349
- name: Wait for Source Blaze
22822350
run: .github/scripts/wait-for-url.sh http://localhost:8080/health
22832351

22842352
- name: Load Data Into Source Blaze
2285-
run: blazectl --no-progress --server http://localhost:8080/fhir upload .github/test-data/synthea
2353+
run: blazectl --no-progress --server http://localhost:8080/fhir upload test-data-synthea-100
22862354

22872355
- name: Wait for Destination Blaze
22882356
run: .github/scripts/wait-for-url.sh http://localhost:8082/health
@@ -2397,8 +2465,17 @@ jobs:
23972465
- name: Run Everything Else
23982466
run: docker compose -f modules/frontend-e2e/docker-compose.yml up -d
23992467

2400-
- name: Sleep 30 Seconds
2401-
run: sleep 30
2468+
- name: Download Synthea Test Data
2469+
uses: ./.github/actions/speicherwolke-download
2470+
with:
2471+
token: b3jf9dsbbJD554E
2472+
filename: synthea-r6-100.tar
2473+
2474+
- name: Create Synthea Test Data Dir
2475+
run: mkdir test-data-synthea-100
2476+
2477+
- name: Unpack Synthea Test Data
2478+
run: tar -C test-data-synthea-100 -xf synthea-r6-100.tar
24022479

24032480
- name: Docker Logs
24042481
run: docker compose -f modules/frontend-e2e/docker-compose.yml logs
@@ -2475,57 +2552,6 @@ jobs:
24752552
#- name: Fetch Patient Expecting an Error
24762553
# run: .github/scripts/fetch-resource-0-with-missing-resource-content.sh
24772554

2478-
# This test ensures that older versions of Blaze will migrate successfully to
2479-
# the new database schema especially building the PatientLastChange index.
2480-
build-patient-last-change-index-test:
2481-
needs: build
2482-
runs-on: ubuntu-24.04
2483-
2484-
steps:
2485-
- name: Check out Git repository
2486-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
2487-
2488-
- name: Install Blazectl
2489-
env:
2490-
GH_TOKEN: ${{ github.token }}
2491-
run: .github/scripts/install-blazectl.sh
2492-
2493-
- name: Download Blaze Image
2494-
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5
2495-
with:
2496-
name: blaze-image
2497-
path: /tmp
2498-
2499-
- name: Load Blaze Image
2500-
run: docker load --input /tmp/blaze.tar
2501-
2502-
- name: Run Blaze in the Version 0.27 before Introduction of the PatientLastChange Index
2503-
run: docker run --name blaze --rm -d -e JAVA_TOOL_OPTIONS=-Xmx2g -e ENABLE_ADMIN_API=true -p 8080:8080 -v blaze-data:/app/data samply/blaze:0.27
2504-
2505-
- name: Wait for Blaze
2506-
run: .github/scripts/wait-for-url.sh http://localhost:8080/health
2507-
2508-
- name: Load Data
2509-
run: blazectl --no-progress --server http://localhost:8080/fhir upload .github/test-data/synthea
2510-
2511-
- name: Ensure that the PatientLastChange Index does not exist
2512-
run: .github/scripts/check-patient-last-change-index-missing.sh
2513-
2514-
- name: Shut down Blaze
2515-
run: docker stop blaze
2516-
2517-
- name: Run Latest Blaze with the PatientLastChange Index
2518-
run: docker run --name blaze -d -e JAVA_TOOL_OPTIONS=-Xmx2g -e ENABLE_ADMIN_API=true -e LOG_LEVEL=debug -p 8080:8080 -v blaze-data:/app/data blaze:latest
2519-
2520-
- name: Wait for Blaze
2521-
run: .github/scripts/wait-for-url.sh http://localhost:8080/health
2522-
2523-
- name: Docker Logs
2524-
run: docker logs blaze
2525-
2526-
- name: Ensure that the State of PatientLastChange Index is Current
2527-
run: .github/scripts/check-patient-last-change-index-state.sh current
2528-
25292555
jepsen-distributed-test:
25302556
needs: build
25312557
runs-on: ubuntu-24.04
@@ -2645,7 +2671,6 @@ jobs:
26452671
- frontend-test
26462672
- missing-resource-content-test
26472673
- custom-search-parameters-test
2648-
- build-patient-last-change-index-test
26492674
runs-on: ubuntu-24.04
26502675
if: always()
26512676
steps:

deps.edn

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@
124124
{blaze/db-stub
125125
{:local/root "modules/db-stub"}
126126

127+
ca.uhn.hapi.fhir/org.hl7.fhir.convertors
128+
{:mvn/version "6.6.3"}
129+
127130
criterium/criterium
128131
{:mvn/version "0.4.6"}
129132

dev/blaze/converter.clj

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
(ns blaze.converter
2+
(:require
3+
[clojure.string :as str])
4+
(:import
5+
[ca.uhn.fhir.context FhirContext]
6+
[java.io File]
7+
[org.hl7.fhir.convertors.factory VersionConvertorFactory_40_50]
8+
[org.hl7.fhir.r4.model Bundle Bundle$BundleEntryComponent Resource ResourceType]))
9+
10+
(def r4 (FhirContext/forR4))
11+
(def r5 (FhirContext/forR5))
12+
13+
(defn parse ^Resource [file]
14+
(let [parser (.newJsonParser ^FhirContext r4)]
15+
(.parseResource parser (slurp file))))
16+
17+
(defn encode [resource]
18+
(let [parser (.newJsonParser ^FhirContext r5)]
19+
(.encodeResourceToString parser resource)))
20+
21+
(defn remove-types [types]
22+
(remove
23+
(fn [^Bundle$BundleEntryComponent entry]
24+
(types (.getResourceType (.getResource entry))))))
25+
26+
(def invalid-types
27+
#{ResourceType/Device ResourceType/MedicationAdministration ResourceType/ImagingStudy})
28+
29+
(defn convert [file]
30+
(let [bundle (parse file)
31+
entries (into [] (remove-types invalid-types) (.getEntry ^Bundle bundle))]
32+
(->> (.setEntry ^Bundle bundle entries)
33+
(VersionConvertorFactory_40_50/convertResource)
34+
(encode)
35+
(spit (str/replace file "synthea" "synthea/r5")))))
36+
37+
(def synthea ".github/test-data/synthea")
38+
39+
(comment
40+
(doseq [file (->> (map str (file-seq (File. synthea)))
41+
(remove #(str/includes? % "/r5"))
42+
(filter #(str/ends-with? % ".json")))]
43+
(convert file)))

job-ig/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ validator_cli.jar:
88
wget -q https://github.com/hapifhir/org.hl7.fhir.core/releases/latest/download/validator_cli.jar
99

1010
validate: validator_cli.jar
11-
java -jar validator_cli.jar -version 4.0.1 -level error -tx n/a -ig fsh-generated/resources fsh-generated/resources/Task-*.json fsh-generated/resources/Bundle-*.json
11+
java -jar validator_cli.jar -version 5.0.0 -level error -tx n/a -ig fsh-generated/resources fsh-generated/resources/Task-*.json fsh-generated/resources/Bundle-*.json
1212

1313
clean:
1414
rm -rf fsh-generated

0 commit comments

Comments
 (0)