Skip to content

Commit

Permalink
Implement CodeSystem/ValueSet $validate-code
Browse files Browse the repository at this point in the history
Closes: #2251 and #2283
  • Loading branch information
alexanderkiel committed Dec 27, 2024
1 parent 14c2700 commit 783d99d
Show file tree
Hide file tree
Showing 125 changed files with 41,694 additions and 849 deletions.
21 changes: 21 additions & 0 deletions .github/scripts/check-capability-statement-terminology-service.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/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 "status" "$(echo "$CAPABILITY_STATEMENT" | jq -r .status)" "active"
test "kind" "$(echo "$CAPABILITY_STATEMENT" | jq -r .kind)" "instance"
test "software name" "$(echo "$CAPABILITY_STATEMENT" | jq -r .software.name)" "Blaze"
test "URL" "$(echo "$CAPABILITY_STATEMENT" | jq -r .implementation.url)" "http://localhost:8080/fhir"
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 "Operation CodeSystem \$validate-code Definition" "$(echo "$CAPABILITY_STATEMENT" | jq -r '.rest[0].resource[] | select(.type == "CodeSystem") .operation[] | select(.name == "validate-code") | .definition')" "http://hl7.org/fhir/OperationDefinition/CodeSystem-validate-code"
test "Operation CodeSystem \$validate-code Documentation" "$(echo "$CAPABILITY_STATEMENT" | jq -r '.rest[0].resource[] | select(.type == "CodeSystem") .operation[] | select(.name == "validate-code") | .documentation')" "Validate that a coded value is in the code system."
test "Operation ValueSet \$expand Definition" "$(echo "$CAPABILITY_STATEMENT" | jq -r '.rest[0].resource[] | select(.type == "ValueSet") .operation[] | select(.name == "expand") | .definition')" "http://hl7.org/fhir/OperationDefinition/ValueSet-expand"
test "Operation ValueSet \$expand Documentation" "$(echo "$CAPABILITY_STATEMENT" | jq -r '.rest[0].resource[] | select(.type == "ValueSet") .operation[] | select(.name == "expand") | .documentation')" "The \$expand operation can be used to expand all codes of a ValueSet."
test "Operation ValueSet \$validate-code Definition" "$(echo "$CAPABILITY_STATEMENT" | jq -r '.rest[0].resource[] | select(.type == "ValueSet") .operation[] | select(.name == "validate-code") | .definition')" "http://hl7.org/fhir/OperationDefinition/ValueSet-validate-code"
test "Operation ValueSet \$validate-code Documentation" "$(echo "$CAPABILITY_STATEMENT" | jq -r '.rest[0].resource[] | select(.type == "ValueSet") .operation[] | select(.name == "validate-code") | .documentation')" "Validate that a coded value is in the set of codes allowed by a value set."
2 changes: 0 additions & 2 deletions .github/scripts/check-capability-statement.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,3 @@ test "format" "$(echo "$CAPABILITY_STATEMENT" | jq -r '.format | join(",")')" "a
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."
test "Operation ValueSet \$expand Definition" "$(echo "$CAPABILITY_STATEMENT" | jq -r '.rest[0].resource[] | select(.type == "ValueSet") .operation[] | select(.name == "expand") | .definition')" "http://hl7.org/fhir/OperationDefinition/ValueSet-expand"
test "Operation ValueSet \$expand Documentation" "$(echo "$CAPABILITY_STATEMENT" | jq -r '.rest[0].resource[] | select(.type == "ValueSet") .operation[] | select(.name == "expand") | .documentation')" "The \$expand operation can be used to expand all codes of a ValueSet."
15 changes: 15 additions & 0 deletions .github/scripts/check-terminology-capabilities.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash -e

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

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

test "resourceType" "$(echo "$TERMINOLOGY_CAPABILITIES" | jq -r .resourceType)" "TerminologyCapabilities"
test "status" "$(echo "$TERMINOLOGY_CAPABILITIES" | jq -r .status)" "active"
test "kind" "$(echo "$TERMINOLOGY_CAPABILITIES" | jq -r .kind)" "instance"
test "software name" "$(echo "$TERMINOLOGY_CAPABILITIES" | jq -r .software.name)" "Blaze"
test "URL" "$(echo "$TERMINOLOGY_CAPABILITIES" | jq -r .implementation.url)" "http://localhost:8080/fhir"

test "UCUM version" "$(echo "$TERMINOLOGY_CAPABILITIES" | jq -r '.codeSystem[] | select(.uri == "http://unitsofmeasure.org").version[0].code' )" "2013.10.21"
3 changes: 3 additions & 0 deletions .github/validation/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/kds-testdata-2024.0.1
kds-testdata-2024.0.1.zip
validator_cli.jar
18 changes: 18 additions & 0 deletions .github/validation/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
kds-testdata-2024.0.1.zip:
wget -q https://github.com/medizininformatik-initiative/mii-testdata/releases/download/v1.0.1/kds-testdata-2024.0.1.zip

kds-test-data: kds-testdata-2024.0.1.zip
unzip kds-testdata-2024.0.1.zip
rm kds-testdata-2024.0.1.zip

validator_cli.jar:
wget -q https://github.com/hapifhir/org.hl7.fhir.validator-wrapper/releases/latest/download/validator_cli.jar

validate-medication: validator_cli.jar
./validate-medication.sh

clean:
rm -rf kds-testdata-2024.0.1
rm -f validator_cli.jar

.PHONY: kds-test-data validate clean
13 changes: 13 additions & 0 deletions .github/validation/validate-medication.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash -e

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

# Doesn't need Snomed CT
java -jar "$SCRIPT_DIR/validator_cli.jar" -version 4.0.1 -level error \
-tx http://localhost:8080/fhir \
-clear-tx-cache \
-ig de.medizininformatikinitiative.kerndatensatz.medikation#2025.0.0 \
"$SCRIPT_DIR/kds-testdata-2024.0.1/resources/MedicationRequest-mii-exa-test-data-patient-3-medrequest-1.json" \
"$SCRIPT_DIR/kds-testdata-2024.0.1/resources/MedicationRequest-mii-exa-test-data-patient-1-medrequest-2.json" \
"$SCRIPT_DIR/kds-testdata-2024.0.1/resources/MedicationRequest-mii-exa-test-data-patient-1-medrequest-1.json" \
"$SCRIPT_DIR/kds-testdata-2024.0.1/resources/MedicationStatement-mii-exa-test-data-patient-3-medstatement-1.json"
6 changes: 3 additions & 3 deletions .github/value-set-expand/AbrechnungsDiagnoseProzedur.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"http://fhir.de/CodeSystem/KontaktDiagnoseProzedur","hospital-main-diagnosis"
"http://fhir.de/CodeSystem/KontaktDiagnoseProzedur","principle-DRG"
"http://fhir.de/CodeSystem/KontaktDiagnoseProzedur","secondary-DRG"
"http://fhir.de/CodeSystem/KontaktDiagnoseProzedur","hospital-main-diagnosis","Krankenhaus Hauptdiagnose"
"http://fhir.de/CodeSystem/KontaktDiagnoseProzedur","principle-DRG","Principle-DRG"
"http://fhir.de/CodeSystem/KontaktDiagnoseProzedur","secondary-DRG","Secondary-DRG"
50 changes: 25 additions & 25 deletions .github/value-set-expand/Abrechnungsart.csv
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","AOP"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","AP"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","ASV"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","BG"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","DMP"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","DRG"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","HSA"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","IA"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","IV"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","KEK"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","KIA"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","KV"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","MVZ"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","PEPP"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","PIA"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","PS"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","PSY"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","REHA"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","SL"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","SPB"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","SPZ"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","SZ"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","VNSB"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","WLA"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","WLU"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","AOP","Ambulantes Operieren"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","AP","Ausländische Patienten (nicht EU)"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","ASV","Ambulante Spezialfachärztliche Versorgung"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","BG","Berufsgenossenschaft"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","DMP","Disease Management Program"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","DRG","Diagnosebezogene Fallgruppen"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","HSA","Hochschulambulanz"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","IA","Gutachten, Institutsabrechnung"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","IV","integrierte Versorgung"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","KEK","Konsile für externe Krankenhäuser"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","KIA","Spezialambulanz in Kinderkliniken"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","KV","KV-Ermächtigung / Notfallabrechnung"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","MVZ","Medizinische Versorgungszentren"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","PEPP","Pauschalierendes Entgeltsystem Psychiatrie und Psychosomatik"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","PIA","Psychiatrische Institutsambulanz"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","PS","Privatsprechstunde"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","PSY","Psychiatrie und Psychosomatik leistungsorientierte, pauschalierte Entgelte"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","REHA","Rehabilitations-Einrichtungen"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","SL","sonstige Leistungserbringer"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","SPB","Stationsäquivalente psychiatrische Behandlung"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","SPZ","Sozialpädiatrische Zentren"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","SZ","Selbstzahlerrechnung"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","VNSB","Vor-/Nachstationäre Behandlung"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","WLA","Wahlleistung Arzt"
"http://fhir.de/CodeSystem/dkgev/Abrechnungsart","WLU","Wahlleistung Unterkunft"
3 changes: 3 additions & 0 deletions .github/value-set-expand/BodySite-Observation-Beatmung.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"http://snomed.info/sct","11527006","Arterial system structure (body structure)"
"http://snomed.info/sct","181216001","Entire lung (body structure)"
"http://snomed.info/sct","89187006","Airway structure (body structure)"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"http://snomed.info/sct","40617009","Artificial ventilation (regime/therapy)"
"http://snomed.info/sct","57485005","Oxygen therapy (procedure)"
37 changes: 37 additions & 0 deletions .github/value-set-expand/Code-Monitoring-und-Vitaldaten-SNOMED.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"http://snomed.info/sct","1153592008","Weight for age percentile (observable entity)"
"http://snomed.info/sct","1153605006","Body height for age percentile (observable entity)"
"http://snomed.info/sct","1153637007","Body height (observable entity)"
"http://snomed.info/sct","118433006","Pulmonary artery wedge pressure (observable entity)"
"http://snomed.info/sct","170804003","Ideal body weight (observable entity)"
"http://snomed.info/sct","248835004","Temperature of breast (observable entity)"
"http://snomed.info/sct","250124002","Temperature of joint (observable entity)"
"http://snomed.info/sct","250844005","Intracranial pressure (observable entity)"
"http://snomed.info/sct","27113001","Body weight (observable entity)"
"http://snomed.info/sct","271649006","Systolic blood pressure (observable entity)"
"http://snomed.info/sct","271650006","Diastolic blood pressure (observable entity)"
"http://snomed.info/sct","276885007","Core body temperature (observable entity)"
"http://snomed.info/sct","276900001","Systemic vascular resistance index (observable entity)"
"http://snomed.info/sct","276902009","Pulmonary vascular resistance index (observable entity)"
"http://snomed.info/sct","277381004","Stroke index (observable entity)"
"http://snomed.info/sct","307047009","Core body temperature measured in rectum (observable entity)"
"http://snomed.info/sct","364075005","Heart rate (observable entity)"
"http://snomed.info/sct","364246006","Core body temperature measured vaginally (observable entity)"
"http://snomed.info/sct","364419004","Temperature of cervical spine (observable entity)"
"http://snomed.info/sct","364424001","Temperature of thoracic spine (observable entity)"
"http://snomed.info/sct","364429006","Temperature of lumbar spine (observable entity)"
"http://snomed.info/sct","415882003","Estimated core body temperature measured in axillary region (observable entity)"
"http://snomed.info/sct","415922000","Temperature of forehead (observable entity)"
"http://snomed.info/sct","415929009","Estimated core body temperature measured in inguinal region (observable entity)"
"http://snomed.info/sct","415945006","Estimated core body temperature measured in sublingual space (observable entity)"
"http://snomed.info/sct","415974002","Core body temperature measured at tympanic membrane (observable entity)"
"http://snomed.info/sct","431598003","Core body temperature measured in esophagus (observable entity)"
"http://snomed.info/sct","54993008","Cardiac index (observable entity)"
"http://snomed.info/sct","6797001","Mean blood pressure (observable entity)"
"http://snomed.info/sct","698831002","Core body temperature measured in nasopharynx (observable entity)"
"http://snomed.info/sct","698832009","Core body temperature measured at urinary bladder (observable entity)"
"http://snomed.info/sct","71420008","Central venous pressure (observable entity)"
"http://snomed.info/sct","75367002","Blood pressure (observable entity)"
"http://snomed.info/sct","82799009","Cardiac output (observable entity)"
"http://snomed.info/sct","8499008","Pulse, function (observable entity)"
"http://snomed.info/sct","860958002","Temperature of blood (observable entity)"
"http://snomed.info/sct","90096001","Stroke volume (observable entity)"
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"http://snomed.info/sct","251286000","Extracorporeal gas exchange duration (observable entity)"
"http://snomed.info/sct","251288004","Extracorporeal gas exchange flow rate (observable entity)"
"http://snomed.info/sct","251289007","Extracorporeal gas exchange flow index (observable entity)"
"http://snomed.info/sct","252076005","Venous pressure (observable entity)"
"http://snomed.info/sct","386534000","Arterial blood pressure (observable entity)"
"http://snomed.info/sct","401000124105","Hemodialysis blood flow (observable entity)"
"http://snomed.info/sct","444479000","Rate of blood flow through cardiovascular device (observable entity)"
"http://snomed.info/sct","445940005","Duration of hemodialysis session (observable entity)"
"http://snomed.info/sct","708513005","Substitution flow rate (observable entity)"
"http://snomed.info/sct","708514004","Substitution volume (observable entity)"
"http://snomed.info/sct","79063001","Gas flow rate (v) (observable entity)"
12 changes: 6 additions & 6 deletions .github/value-set-expand/Diagnosesubtyp.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"http://fhir.de/CodeSystem/KontaktDiagnoseProzedur","cause-of-death"
"http://fhir.de/CodeSystem/KontaktDiagnoseProzedur","department-main-diagnosis"
"http://fhir.de/CodeSystem/KontaktDiagnoseProzedur","infection-control-diagnosis"
"http://fhir.de/CodeSystem/KontaktDiagnoseProzedur","surgery-diagnosis"
"http://terminology.hl7.org/CodeSystem/diagnosis-role","AD"
"http://terminology.hl7.org/CodeSystem/diagnosis-role","DD"
"http://fhir.de/CodeSystem/KontaktDiagnoseProzedur","cause-of-death","Todesursache"
"http://fhir.de/CodeSystem/KontaktDiagnoseProzedur","department-main-diagnosis","Abteilung Hauptdiagnose"
"http://fhir.de/CodeSystem/KontaktDiagnoseProzedur","infection-control-diagnosis","Infektionsschutzdiagnose"
"http://fhir.de/CodeSystem/KontaktDiagnoseProzedur","surgery-diagnosis","Operationsdiagnose"
"http://terminology.hl7.org/CodeSystem/diagnosis-role","AD","Admission diagnosis"
"http://terminology.hl7.org/CodeSystem/diagnosis-role","DD","Discharge diagnosis"
2 changes: 2 additions & 0 deletions .github/value-set-expand/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
install:
npm install
Loading

0 comments on commit 783d99d

Please sign in to comment.