Add MIABIS-on-FHIR 1.0.0 project support#327
Open
a-tuerk wants to merge 7 commits intosamply:developfrom
Open
Conversation
Adds a new `miabis` project backed by the MIABIS-on-FHIR 1.0.0 Implementation Guide (hosted at https://fhir.bbmri-eric.eu). Key differences from the existing `bbmri` (de.bbmri.fhir) project: - Sample type uses `miabis-detailed-samply-type-cs` CodeSystem - Storage temperature is in `Specimen.processing[].extension` (not `Specimen.extension`) - Custodian link is via `valueIdentifier` (not `valueReference`) - Diagnosis uses ICD-10 only (`http://hl7.org/fhir/sid/icd-10`), no German ICD-10-GM variant and no SampleDiagnosis extension Includes: - `src/projects/miabis/mod.rs` – code lists, CQL snippets, sample type workarounds mapping canonical Sample Locator codes to MIABIS codes - `src/projects/miabis/template.cql` – CQL template with SampleType, StorageTemperature, Custodian, DiagnosisCode functions - `src/projects/miabis/body.json` – Measure definition with patient, diagnosis, and specimen groups + stratifiers - `src/projects/mod.rs` – wires in the new `MiabisOnFhir` project variant (project name string: `"miabis"`) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The IG is hosted at https://fhir.miabis.bbmri-eric.eu/; the canonical resource profile URLs (used in the code) still correctly reference https://fhir.bbmri-eric.eu. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Five unit tests in cql::test covering the MIABIS-specific CQL fragments: - test_miabis_empty: mandatory code systems always declared - test_miabis_gender: patient-level snippet - test_miabis_diagnosis: ICD-10 only (no GM variants) - test_miabis_sample_kind: canonical code + TissueFixed workaround - test_miabis_storage_temperature: nested Specimen.processing[].extension path Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Bug fix: StorageTemperature was defined as a patient-level define, causing Blaze to use the first specimen's temperature for all specimens of the same patient in the stratifier. Changed to a function with a FHIR.Specimen parameter (consistent with SampleType) so Blaze evaluates it per-specimen. E2E test (dev/test_miabis_e2e.sh): - Starts a local Blaze instance via Docker - Loads a minimal MIABIS-on-FHIR 1.0.0 test bundle (resources/test/miabis_e2e_bundle.json: 2 patients, 2 conditions, 3 specimens covering blood-plasma/tissue-ffpe/whole-blood and LN/RT) - Sends an AST task with metadata.project = "miabis" via a mock Beam proxy - Verifies all 14 expected counts in the returned MeasureReport The E2E test also caught the StorageTemperature bug before this commit. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Lens sends canonical temperature codes (e.g. temperatureRoom, temperatureLN) but MIABIS-on-FHIR 1.0.0 stores native codes (RT, LN, -18to-35, …). Add STORAGE_TEMPERATURE_WORKAROUNDS in miabis/mod.rs, expose it via Project::get_storage_temperature_workarounds(), and wire it into the CQL generator alongside the existing sample-type workaround. "storage_temperature_uncharted" is intentionally left unmapped; queries for it return zero results on MIABIS nodes, which is correct. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ture criteria Previously both SAMPLE_TYPE_WORKAROUNDS and STORAGE_TEMPERATURE_WORKAROUNDS were applied to every In/Equals criterion regardless of criterion key. Any criterion value that coincidentally matched a workaround map key would silently gain extra OR clauses. Guard both lookups on condition_key_trans so the maps are only consulted for the criteria they are defined for. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…, not Czech BBMRI-cz Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
miabisproject backed by the MIABIS-on-FHIR 1.0.0Implementation Guide (hosted at https://fhir.miabis.bbmri-eric.eu/;
canonical resource profile URLs use https://fhir.bbmri-eric.eu)
metadata.project = "miabis"in Beam tasksKey Differences from
bbmri(de.bbmri.fhir)SampleMaterialTypemiabis-detailed-samply-type-cs—SAMPLE_TYPE_WORKAROUNDSmaps Sample Locator codes to MIABIS codes, both ORed into CQLSTORAGE_TEMPERATURE_WORKAROUNDSmaps Lens codes (e.g.temperatureRoom) to MIABIS codes (e.g.RT), both ORed into CQL;storage_temperature_unchartedintentionally unmappedSpecimen.extensionSpecimen.processing[].extension—StorageTemperature()is a function (not a define) so Blaze evaluates it per-specimen in the stratifiervalueReferencevalueIdentifierhttp://hl7.org/fhir/sid/icd-10)Files Modified
src/projects/miabis/mod.rs— code list URIs, CQL snippets,SAMPLE_TYPE_WORKAROUNDS,STORAGE_TEMPERATURE_WORKAROUNDS, mandatory code listssrc/projects/miabis/template.cql— CQL template withSampleType(),StorageTemperature(),Custodian,DiagnosisCode()src/projects/miabis/body.json— FHIR Measure definitionsrc/projects/mod.rs— newMiabisOnFhirenum variant wired into all getter methods;get_storage_temperature_workarounds()method; sharedEMPTY_WORKAROUNDSfor other projectssrc/cql.rs— wiresSAMPLE_TYPE_WORKAROUNDSandSTORAGE_TEMPERATURE_WORKAROUNDSinto CQL generation forConditionType::Inand::EqualsTesting
Unit tests (
cargo test test_miabis, no external services): two test functions covering the workaround mechanism —test_miabis_storage_temperature_workarounds(EQUALS with mapping, EQUALS with 1:1mapping, IN with multiple mappings, unmapped code passthrough) and
test_miabis_sample_type_workarounds(EQUALS, IN, 1:many mapping).End-to-end test (
dev/test_miabis_e2e.sh, requires Docker): self-contained script with test data inresources/test/miabis_e2e_bundle.json. Starts Blaze, loads the bundle, runs focus against a mockBeam proxy, and verifies 14 counts in the MeasureReport. Found and fixed a real bug:
StorageTemperaturewas a patient-leveldefine, causing all specimens of a patient to inherit the first specimen'stemperature.
Extended E2E suite (10 scenarios, 1–25 donors, 1–5 collections, up to 59 specimens): 269 checks, 0 failures. Synthetic bundles generated via
a-tuerk/miabis_on_fhir_synth. The companion repo a-tuerk/miabis_on_fhir_bridgehead contains two
additional test scripts not part of this PR:
test_miabis_branch.sh(5 targeted scenarios testing code translation and empty-AST behaviour) andrun_e2e_suite.py(10 synthetic-bundle scenarios, 269 countsverified).