Skip to content

Commit

Permalink
Merge pull request #48 from medizininformatik-initiative/support-refe…
Browse files Browse the repository at this point in the history
…rence-resolve

Add Support for Reference Resolve
  • Loading branch information
bastianschaffer authored Nov 21, 2024
2 parents 370cabe + 06a56a7 commit 19cce29
Show file tree
Hide file tree
Showing 24 changed files with 1,012 additions and 152 deletions.
32 changes: 32 additions & 0 deletions .github/integration-test/evaluate-reference-resolve.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash -e

DOCKER_COMPOSE_FILE=.github/integration-test/$1/docker-compose.yml
export FDE_INPUT_MEASURE=/${PWD}/.github/integration-test/measures/reference-resolve-measure.json
export FDE_OUTPUT_DIR=$PWD/.github/integration-test/evaluate-reference-resolve-test
export FDE_CONVERT_TO_CSV=false

mkdir "$FDE_OUTPUT_DIR"
docker compose -f "$DOCKER_COMPOSE_FILE" run -e TZ="$(cat /etc/timezone)" fhir-data-evaluator

today=$(date +"%Y-%m-%d")
OUTPUT_DIR=$(find "$FDE_OUTPUT_DIR" -type d -name "*$today*" | head -n 1)
REPORT=$(cat "$OUTPUT_DIR"/measure-report.json)

EXPECTED_POPULATION_COUNT=1
EXPECTED_STRATIFIER_COUNT=1

POPULATION_COUNT=$(echo "$REPORT" | jq '.group[0].population[0].count')
if [ "$POPULATION_COUNT" = "$EXPECTED_POPULATION_COUNT" ]; then
echo "OK 👍: population count ($POPULATION_COUNT) equals the expected count"
else
echo "Fail 😞: population count ($POPULATION_COUNT) != $EXPECTED_POPULATION_COUNT"
exit 1
fi

STRATIFIER_COUNT=$(echo "$REPORT" | jq -r '.group[0].stratifier[0].stratum[0].population[0].count')
if [ "$STRATIFIER_COUNT" = "$EXPECTED_STRATIFIER_COUNT" ]; then
echo "OK 👍: stratifier count ($STRATIFIER_COUNT) equals the expected count"
else
echo "Fail 😞: stratifier ($STRATIFIER_COUNT) != $EXPECTED_STRATIFIER_COUNT"
exit 1
fi
56 changes: 56 additions & 0 deletions .github/integration-test/measures/reference-resolve-measure.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"resourceType": "Measure",
"meta": {
"profile": [
"http://fhir-data-evaluator/StructureDefinition/FhirDataEvaluatorBasicMeasure"
]
},
"version": "1.0",
"url": "https://medizininformatik-initiative.de/fhir/fdpg/Measure/ExampleReferenceResolve",
"status": "active",
"experimental": false,
"publisher": "FDPG-Plus",
"name": "ExampleReferenceResolve",
"title": "Example Reference Resolve",
"description": "Example Measure to resolve references.",
"date": "2024-05-10",
"group": [
{
"description": "Simple Stratifier concept",
"population": [
{
"code": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/measure-population",
"code": "initial-population"
}
]
},
"criteria": {
"language": "text/x-fhir-query",
"expression": "MedicationAdministration?_include=MedicationAdministration:medication"
},
"id": "initial-population-identifier"
}
],
"stratifier": [
{
"criteria": {
"language": "text/fhirpath",
"expression": "MedicationAdministration.medication.resolve().ofType(Medication).code.coding"
},
"code": {
"coding": [
{
"system": "http://fhir-evaluator/strat/system",
"code": "medication-coding"
}
]
},
"id": "strat-1"
}
]
}
]
}
47 changes: 47 additions & 0 deletions .github/integration-test/test-data/Bundle.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,53 @@
"method": "POST",
"url": "Observation/18c097fd-4263-8f4e-4307-f21ed5b01bcd"
}
},
{
"resource": {
"resourceType": "MedicationAdministration",
"id": "med-adm-1",
"meta": {
"versionId": "974",
"lastUpdated": "2024-04-16T15:02:56.856Z"
},
"status": "completed",
"medicationReference": {
"reference": "Medication/med-1"
},
"effectiveDateTime": "2016-06-13T10:04:58Z"
},
"request": {
"method": "PUT",
"url": "MedicationAdministration/med-adm-1"
}
},
{
"resource": {
"resourceType": "Medication",
"id": "med-1",
"meta": {
"versionId": "974",
"lastUpdated": "2024-04-16T15:02:56.856Z",
"profile": [
"http://hl7.org/fhir/us/core/StructureDefinition/us-core-medication"
]
},
"code": {
"coding": [
{
"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "1000126",
"display": "1 ML medroxyprogesterone acetate 150 MG/ML Injection"
}
],
"text": "1 ML medroxyprogesterone acetate 150 MG/ML Injection"
},
"status": "active"
},
"request": {
"method": "PUT",
"url": "Medication/med-1"
}
}
]
}
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ jobs:
- name: Run Integration Test for Unique Count with Components and with CSV
run: .github/integration-test/evaluate-unique-count-with-components-to-csv.sh ${{ matrix.test }}

- name: Run Integration Test for Reference Resolve
run: .github/integration-test/evaluate-reference-resolve.sh ${{ matrix.test }}

- name: Run Integration Test to check if it correctly exits when there are insufficient writing permissions
run: .github/integration-test/missing-permissions-test.sh

Expand Down
56 changes: 56 additions & 0 deletions Documentation/example-measures/example-measure-11.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"resourceType": "Measure",
"meta": {
"profile": [
"http://fhir-data-evaluator/StructureDefinition/FhirDataEvaluatorBasicMeasure"
]
},
"version": "1.0",
"url": "https://medizininformatik-initiative.de/fhir/fdpg/Measure/ExampleReferenceResolve",
"status": "active",
"experimental": false,
"publisher": "FDPG-Plus",
"name": "ExampleReferenceResolve",
"title": "Example Reference Resolve",
"description": "Example Measure to resolve references.",
"date": "2024-05-10",
"group": [
{
"description": "Simple Stratifier concept",
"population": [
{
"code": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/measure-population",
"code": "initial-population"
}
]
},
"criteria": {
"language": "text/x-fhir-query",
"expression": "MedicationAdministration?_include=MedicationAdministration:medication"
},
"id": "initial-population-identifier"
}
],
"stratifier": [
{
"criteria": {
"language": "text/fhirpath",
"expression": "MedicationAdministration.medication.resolve().ofType(Medication).code.coding.where(system='http://fhir.de/CodeSystem/bfarm/atc')"
},
"code": {
"coding": [
{
"system": "http://fhir-evaluator/strat/system",
"code": "medication-coding"
}
]
},
"id": "strat-1"
}
]
}
]
}
Loading

0 comments on commit 19cce29

Please sign in to comment.