Skip to content

Commit

Permalink
Support Custom Profiles
Browse files Browse the repository at this point in the history
Closes: #979
  • Loading branch information
alexanderkiel committed Mar 10, 2025
1 parent 68b97b7 commit caf4988
Show file tree
Hide file tree
Showing 43 changed files with 632 additions and 423 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash -e

SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
. "$SCRIPT_DIR/util.sh"

BASE="http://localhost:8080/fhir"
CAPABILITY_STATEMENT=$(curl -sH 'Accept: application/fhir+json' "$BASE/metadata")

test "Patient Supported Profile" "$(echo "$CAPABILITY_STATEMENT" | jq -r '.rest[0].resource[] | select(.type == "Patient") .supportedProfile[0]')" "https://www.medizininformatik-initiative.de/fhir/core/modul-person/StructureDefinition/Patient|2025.0.0"
2 changes: 2 additions & 0 deletions .github/scripts/check-capability-statement.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ test "URL" "$(echo "$CAPABILITY_STATEMENT" | jq -r .implementation.url)" "http:/
test "FHIR version" "$(echo "$CAPABILITY_STATEMENT" | jq -r .fhirVersion)" "4.0.1"
test "format" "$(echo "$CAPABILITY_STATEMENT" | jq -r '.format | join(",")')" "application/fhir+json,application/fhir+xml"

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

test "Operation Measure \$evaluate-measure Definition" "$(echo "$CAPABILITY_STATEMENT" | jq -r '.rest[0].resource[] | select(.type == "Measure") .operation[] | select(.name == "evaluate-measure") | .definition')" "http://hl7.org/fhir/OperationDefinition/Measure-evaluate-measure"
test "Operation Patient \$everything Definition" "$(echo "$CAPABILITY_STATEMENT" | jq -r '.rest[0].resource[] | select(.type == "Patient") .operation[] | select(.name == "everything") | .definition')" "http://hl7.org/fhir/OperationDefinition/Patient-everything"
test "Operation Patient \$everything Documentation" "$(echo "$CAPABILITY_STATEMENT" | jq -r '.rest[0].resource[] | select(.type == "Patient") .operation[] | select(.name == "everything") | .documentation')" "Returns all resources from the patient compartment of one concrete patient including the patient. Has a fix limit of 10,000 resources if paging isn't used. Paging is supported when the _count parameter is used. No other params are supported."
Expand Down
5 changes: 5 additions & 0 deletions .github/scripts/upload-profile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash -e

BASE="http://localhost:8080/fhir"

curl -s -f -H 'Content-Type: application/fhir+json' -H 'Prefer: return=minimal' -d @"$1" "$BASE/StructureDefinition"
9 changes: 9 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,15 @@ jobs:
- name: Chaining on DocumentReference
run: .github/scripts/chaining-document-reference.sh

- name: Download Modul Person
run: wget --content-disposition https://packages.simplifier.net/de.medizininformatikinitiative.kerndatensatz.person/2025.0.0

- name: Unpack Modul Person
run: tar xzf de.medizininformatikinitiative.kerndatensatz.person-2025.0.0.tgz

- name: Upload StructureDefinition Person
run: .github/scripts/upload-profile.sh package/StructureDefinition-mii-pr-person-patient.json

- name: Prometheus Metrics
run: .github/scripts/test-metrics.sh
if: ${{ matrix.variant == 'standalone' }}
Expand Down
26 changes: 25 additions & 1 deletion modules/frontend-e2e/src/fhir.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test('History Page', async ({page}) => {
await page.getByRole('link', {name: 'History', exact: true}).click();

await expect(page).toHaveTitle("History - Blaze");
await expect(page.getByText('Total: 92,299')).toBeVisible();
await expect(page.getByText('Total: 92,300')).toBeVisible();
});

test('Metadata Page', async ({page}) => {
Expand All @@ -56,7 +56,22 @@ test('Metadata Page', async ({page}) => {
await expect(page.getByRole('heading', {name: 'Blaze'})).toBeVisible();
await expect(page.getByRole('link', {name: 'Account'})).toBeVisible();
await expect(page.getByRole('link', {name: 'ActivityDefinition'})).toBeVisible();
await expect(page.getByRole('link', {name: 'Encounter'})).toBeVisible();

await page.getByRole('link', {name: 'Encounter'}).click();

await expect(page).toHaveTitle("Encounter - Metadata - Blaze");
await expect(page.getByRole('heading', {name: 'Encounter'})).toBeVisible();
await expect(page.getByRole('link', {name: 'Resources'})).toBeVisible();
await expect(page.getByText('Supported Profiles', {exact : true})).toBeVisible();
await expect(page.getByRole('link', {name: 'KontaktGesundheitseinrichtung'})).toBeVisible();
await expect(page.getByText('Search Parameters')).toBeVisible();
await expect(page.getByText('(date) – date')).toBeVisible();

await page.getByRole('link', {name: 'Resources'}).click();

await expect(page).toHaveTitle("Encounter - Blaze");
await expect(page.getByText('Total: 4,769')).toBeVisible();
});

test.describe('Admin', () => {
Expand Down Expand Up @@ -233,8 +248,17 @@ test('Patients Page', async ({page}) => {
await page.getByRole('link', {name: 'Patient'}).click();

await expect(page).toHaveTitle("Patient - Blaze");
await expect(page.getByTitle('Patient History')).toBeVisible();
await expect(page.getByTitle('Patient Metadata')).toBeVisible();
await expect(page.getByText('Total: 120')).toBeVisible();

await page.getByTitle('Patient Metadata').click();
await expect(page).toHaveTitle("Patient - Metadata - Blaze");
await expect(page.getByRole('heading', {name: 'Patient'})).toBeVisible();

await page.goBack();
await expect(page).toHaveTitle("Patient - Blaze");

// Go to next page
await page.getByRole('link', {name: 'Next'}).first().click();
await expect(page.getByText('Non-First Page')).toBeVisible();
Expand Down
14 changes: 12 additions & 2 deletions modules/frontend-e2e/upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@

SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"

BASE="https://blaze.localhost/fhir"
CA_CERT="$SCRIPT_DIR/../ingress/blaze-cert.pem"
TOKEN="$("$SCRIPT_DIR/fetch-access-token.sh")"

blazectl --no-progress \
--server https://blaze.localhost/fhir \
--server "$BASE" \
--certificate-authority "$CA_CERT" \
--token "$("$SCRIPT_DIR/fetch-access-token.sh")" \
--token "$TOKEN" \
upload "$SCRIPT_DIR/../../.github/test-data/synthea"

upload_profile() {
curl -sfH 'Content-Type: application/fhir+json' -H 'Prefer: return=minimal' --cacert "$CA_CERT" --oauth2-bearer "$TOKEN" -d @"$1" "$BASE/StructureDefinition"
}

wget -q --content-disposition "https://packages.simplifier.net/de.medizininformatikinitiative.kerndatensatz.fall/2025.0.0"
tar xzf de.medizininformatikinitiative.kerndatensatz.fall-2025.0.0.tgz
upload_profile package/StructureDefinition-mii-ex-fall-planned-start-date.json
6 changes: 6 additions & 0 deletions modules/frontend/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,11 @@ export default ts.config(
},
{
ignores: ['build/', '.svelte-kit/', 'dist/']
},
{
rules: {
'svelte/no-useless-mustaches': 'warn',
'svelte/require-each-key': 'warn'
}
}
);
Loading

0 comments on commit caf4988

Please sign in to comment.