-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also added an integration test that failed with the previos mutable increment population
- Loading branch information
1 parent
62fbd16
commit 87e6717
Showing
24 changed files
with
587 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
#!/bin/bash -e | ||
|
||
INPUT_MEASURE=$1 | ||
BASE_OUTPUT_DIR=$PWD/.github/integration-test/evaluate-multiple-stratifiers | ||
mkdir "$BASE_OUTPUT_DIR" | ||
|
||
docker run -v "$INPUT_MEASURE":/app/measure.json -v "$BASE_OUTPUT_DIR":/app/output/ -e FHIR_SERVER=http://fhir-server:8080/fhir \ | ||
-e TZ="$(cat /etc/timezone)" --network integration-test_testing-network fhir-data-evaluator | ||
|
||
today=$(date +"%Y-%m-%d") | ||
OUTPUT_DIR=$(find "$BASE_OUTPUT_DIR" -type d -name "*$today*" | head -n 1) | ||
REPORT="$OUTPUT_DIR/measure-report.json" | ||
|
||
find_stratum() { | ||
local STRATIFIER_INDEX="$1" | ||
local EXPECTED_VALUE="$2" | ||
local STRATUM=$(jq -c --arg EXPECTED_VALUE "$EXPECTED_VALUE" --argjson STRATIFIER_INDEX "$STRATIFIER_INDEX" ' | ||
.group[0].stratifier[$STRATIFIER_INDEX].stratum[] | select(.value.coding[0].code == $EXPECTED_VALUE)' "$REPORT" ) | ||
echo "$STRATUM" | ||
} | ||
|
||
validate_stratum() { | ||
local STRATUM="$1" | ||
local STRATUM_VALUE="$2" | ||
local EXPECTED_INITIAL_POP_COUNT="$3" | ||
local EXPECTED_MEASURE_POP_COUNT="$4" | ||
local EXPECTED_OBSERVATION_POP_COUNT="$5" | ||
local EXPECTED_MEASURE_SCORE="$6" | ||
|
||
local INITIAL_POP_COUNT=$(jq '.population[] | select(.code.coding[0].code == "initial-population").count' <<< "$STRATUM") | ||
local MEASURE_POP_COUNT=$(jq '.population[] | select(.code.coding[0].code == "measure-population").count' <<< "$STRATUM") | ||
local OBSERVATION_POP_COUNT=$(jq '.population[] | select(.code.coding[0].code == "measure-observation").count' <<< "$STRATUM") | ||
local MEASURE_SCORE=$(jq '.measureScore.value' <<< "$STRATUM") | ||
|
||
|
||
|
||
if [ "$INITIAL_POP_COUNT" = "$EXPECTED_INITIAL_POP_COUNT" ]; then | ||
echo "OK 👍: initial population count ($INITIAL_POP_COUNT) equals the expected count for (value=$STRATUM_VALUE)" | ||
else | ||
echo "Fail 😞: stratum count ($INITIAL_POP_COUNT) != $EXPECTED_INITIAL_POP_COUNT for initial population (value=$STRATUM_VALUE)" | ||
exit 1 | ||
fi | ||
|
||
if [ "$MEASURE_POP_COUNT" = "$EXPECTED_MEASURE_POP_COUNT" ]; then | ||
echo "OK 👍: measure population count ($MEASURE_POP_COUNT) equals the expected count for (value=$STRATUM_VALUE)" | ||
else | ||
echo "Fail 😞: stratum count ($MEASURE_POP_COUNT) != $EXPECTED_MEASURE_POP_COUNT for measure population (value=$STRATUM_VALUE)" | ||
exit 1 | ||
fi | ||
|
||
if [ "$OBSERVATION_POP_COUNT" = "$EXPECTED_OBSERVATION_POP_COUNT" ]; then | ||
echo "OK 👍: observation population count ($OBSERVATION_POP_COUNT) equals the expected count for (value=$STRATUM_VALUE)" | ||
else | ||
echo "Fail 😞: stratum count ($OBSERVATION_POP_COUNT) != $EXPECTED_OBSERVATION_POP_COUNT for measure observation (value=$STRATUM_VALUE)" | ||
exit 1 | ||
fi | ||
|
||
if [ "$MEASURE_SCORE" = "$EXPECTED_MEASURE_SCORE" ]; then | ||
echo "OK 👍: measure score ($MEASURE_SCORE) equals the expected count for (value=$STRATUM_VALUE)" | ||
else | ||
echo "Fail 😞: stratum count ($MEASURE_SCORE) != $EXPECTED_MEASURE_SCORE for measure score (value=$STRATUM_VALUE)" | ||
exit 1 | ||
fi | ||
} | ||
|
||
get_stratum() { | ||
local STRATIFIER_INDEX="$1" | ||
local STRATUM_INDEX="$2" | ||
echo $(jq --argjson STRATIFIER_INDEX "$STRATIFIER_INDEX" --argjson STRATUM_INDEX "STRATUM_INDEX" '.population[] | ||
| select(.code.coding[0].code == "initial-population").count' "$STRATUM") | ||
} | ||
|
||
|
||
EXPECTED_STRATUM_VALUE_1="I48.0" | ||
EXPECTED_STRATUM_INITIAL_POP_1=108 | ||
EXPECTED_STRATUM_MEASURE_POP_1=108 | ||
EXPECTED_STRATUM_OBESERVATION_POP_1=108 | ||
EXPECTED_STRATUM_MEASURE_SCORE_1=108 | ||
|
||
EXPECTED_STRATUM_VALUE_2="fail-no-value-found" | ||
EXPECTED_STRATUM_INITIAL_POP_2=12072 | ||
EXPECTED_STRATUM_MEASURE_POP_2=12072 | ||
EXPECTED_STRATUM_OBESERVATION_POP_2=12072 | ||
EXPECTED_STRATUM_MEASURE_SCORE_2=12040 | ||
|
||
|
||
STRATUM=$(find_stratum 0 $EXPECTED_STRATUM_VALUE_1) | ||
validate_stratum "$STRATUM" $EXPECTED_STRATUM_VALUE_1 $EXPECTED_STRATUM_INITIAL_POP_1 $EXPECTED_STRATUM_MEASURE_POP_1 \ | ||
$EXPECTED_STRATUM_OBESERVATION_POP_1 $EXPECTED_STRATUM_MEASURE_SCORE_1 | ||
|
||
STRATUM=$(find_stratum 1 $EXPECTED_STRATUM_VALUE_2) | ||
validate_stratum "$STRATUM" $EXPECTED_STRATUM_VALUE_2 $EXPECTED_STRATUM_INITIAL_POP_2 $EXPECTED_STRATUM_MEASURE_POP_2 \ | ||
$EXPECTED_STRATUM_OBESERVATION_POP_2 $EXPECTED_STRATUM_MEASURE_SCORE_2 |
109 changes: 109 additions & 0 deletions
109
.github/integration-test/measures/multiple-stratifiers.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
{ | ||
"resourceType": "Measure", | ||
"meta": { | ||
"profile": [ | ||
"http://fhir-data-evaluator/StructureDefinition/FhirDataEvaluatorContinuousVariableMeasure" | ||
] | ||
}, | ||
"version": "1.0", | ||
"url": "https://medizininformatik-initiative.de/fhir/fdpg/Measure/ExampleCdsCriteria", | ||
"status": "active", | ||
"experimental": false, | ||
"publisher": "FDPG-Plus", | ||
"name": "ExampleCdsCriteria", | ||
"title": "Example Measure To Count CDS Criteria", | ||
"description": "Example measure to count CDS criteria", | ||
"group": [ | ||
{ | ||
"population": [ | ||
{ | ||
"code": { | ||
"coding": [ | ||
{ | ||
"system": "http://terminology.hl7.org/CodeSystem/measure-population", | ||
"code": "initial-population" | ||
} | ||
] | ||
}, | ||
"criteria": { | ||
"language": "text/x-fhir-query", | ||
"expression": "Condition?_profile=https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" | ||
}, | ||
"id": "initial-population-identifier-1" | ||
}, | ||
{ | ||
"code": { | ||
"coding": [ | ||
{ | ||
"system": "http://terminology.hl7.org/CodeSystem/measure-population", | ||
"code": "measure-population" | ||
} | ||
] | ||
}, | ||
"criteria": { | ||
"language": "text/fhirpath", | ||
"expression": "Condition" | ||
}, | ||
"id": "measure-population-identifier-1" | ||
}, | ||
{ | ||
"code": { | ||
"coding": [ | ||
{ | ||
"system": "http://terminology.hl7.org/CodeSystem/measure-population", | ||
"code": "measure-observation" | ||
} | ||
] | ||
}, | ||
"criteria": { | ||
"language": "text/fhirpath", | ||
"expression": "Condition.subject.reference" | ||
}, | ||
"extension": [ | ||
{ | ||
"url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-aggregateMethod", | ||
"valueCode": "unique-count" | ||
}, | ||
{ | ||
"url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-criteriaReference", | ||
"valueString": "measure-population-identifier-1" | ||
} | ||
], | ||
"id": "measure-observation-identifier-1" | ||
} | ||
], | ||
"stratifier": [ | ||
{ | ||
"criteria": { | ||
"language": "text/fhirpath", | ||
"expression": "Condition.code.coding.where(system='http://fhir.de/CodeSystem/bfarm/icd-10-gm')" | ||
}, | ||
"code": { | ||
"coding": [ | ||
{ | ||
"system": "http://fhir-evaluator/strat/system", | ||
"code": "condition-icd10-code" | ||
} | ||
] | ||
}, | ||
"id": "strat-1" | ||
}, | ||
{ | ||
"criteria": { | ||
"language": "text/fhirpath", | ||
"expression": "Condition.code.coding.where(system='http://snomed.info/sct')" | ||
}, | ||
"code": { | ||
"coding": [ | ||
{ | ||
"system": "http://fhir-evaluator/strat/system", | ||
"code": "condition-sct-code" | ||
} | ||
] | ||
}, | ||
"id": "strat-2" | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
MII_TESTDATA_DOWNLOAD_URL="https://health-atlas.de/data_files/594/download?version=1" | ||
|
||
wget -O testdata.zip "$MII_TESTDATA_DOWNLOAD_URL" | ||
unzip testdata.zip -d testdata-temp | ||
cd testdata-temp/Vorhofflimmern || exit | ||
|
||
for file in *.json.zip | ||
do | ||
unzip -o "$file" -d ../../.github/integration-test/Vorhofflimmern | ||
done | ||
|
||
cd ../../ | ||
rm testdata.zip | ||
rm -rf testdata-temp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 8 additions & 1 deletion
9
src/main/java/de/medizininformatikinitiative/fhir_data_evaluator/ComponentExpression.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.