Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/bbmri cql #93

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,11 @@ const getSingleton = (criterion: AstBottomLayerValue): string => {
if (myCQL) {
switch (myCriterion.type) {
case "gender":
case "BBMRI_gender":
case "histology":
case "conditionValue":
case "BBMRI_conditionValue":
case "BBMRI_conditionSampleDiagnosis":
case "conditionBodySite":
case "conditionLocalization":
case "observation":
Expand All @@ -131,6 +134,8 @@ const getSingleton = (criterion: AstBottomLayerValue): string => {
case "procedureResidualstatus":
case "medicationStatement":
case "specimen":
case "BBMRI_specimen":
case "BBMRI_hasSpecimen":
case "hasSpecimen":
case "Organization":
case "observationMolecularMarkerName":
Expand Down
116 changes: 116 additions & 0 deletions packages/lib/src/cql-translator-service/cqlquery-mappings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,21 @@ export const alias = new Map<string, string>([
"http://dktk.dkfz.de/fhir/onco/core/CodeSystem/TNMmSymbolCS",
],
["molecularMarker", "http://www.genenames.org"],

["BBMRI_icd10", "http://hl7.org/fhir/sid/icd-10"],
["BBMRI_icd10gm", "http://fhir.de/CodeSystem/dimdi/icd-10-gm"],
[
"BBMRI_SampleMaterialType",
"https://fhir.bbmri.de/CodeSystem/SampleMaterialType",
], //specimentype
[
"BBMRI_StorageTemperature",
"https://fhir.bbmri.de/CodeSystem/StorageTemperature",
],
[
"BBMRI_SmokingStatus",
"http://hl7.org/fhir/uv/ips/ValueSet/current-smoking-status-uv-ips",
],
]);

export const cqltemplate = new Map<string, string>([
Expand Down Expand Up @@ -192,6 +207,69 @@ export const cqltemplate = new Map<string, string>([
"(exists ([Observation: Code '21908-9' from loinc] O where O.value.coding.code contains '{{C}}')) or (exists ([Observation: Code '21902-2' from loinc] O where O.value.coding.code contains '{{C}}'))",
],
["histology", "exists from [Observation: Code '59847-4' from loinc] O\n"],

["BBMRI_gender", "Patient.gender"],
[
"BBMRI_conditionSampleDiagnosis",
"((exists[Condition: Code '{{C}}' from {{A1}}]) or (exists[Condition: Code '{{C}}' from {{A2}}])) or (exists from [Specimen] S where (S.extension.where(url='https://fhir.bbmri.de/StructureDefinition/SampleDiagnosis').value.coding.code contains '{{C}}'))",
],
["BBMRI_conditionValue", "exists [Condition: Code '{{C}}' from {{A1}}]"],
[
"BBMRI_conditionRangeDate",
"exists from [Condition] C\nwhere FHIRHelpers.ToDateTime(C.onset) between {{D1}} and {{D2}}",
],
[
"BBMRI_conditionRangeAge",
"exists from [Condition] C\nwhere AgeInYearsAt(FHIRHelpers.ToDateTime(C.onset)) between Ceiling({{D1}}) and Ceiling({{D2}})",
],
["BBMRI_age", "AgeInYears() between Ceiling({{D1}}) and Ceiling({{D2}})"],
[
"BBMRI_observation",
"exists from [Observation: Code '{{K}}' from {{A1}}] O\nwhere O.value.coding.code contains '{{C}}'",
],
[
"BBMRI_observationSmoker",
"exists from [Observation: Code '72166-2' from {{A1}}] O\nwhere O.value.coding.code contains '{{C}}'",
],
[
"BBMRI_observationRange",
"exists from [Observation: Code '{{K}}' from {{A1}}] O\nwhere O.value between {{D1}} and {{D2}}",
],
[
"BBMRI_observationBodyWeight",
"exists from [Observation: Code '29463-7' from {{A1}}] O\nwhere ((O.value as Quantity) < {{D1}} 'kg' and (O.value as Quantity) > {{D2}} 'kg')",
],
[
"BBMRI_observationBMI",
"exists from [Observation: Code '39156-5' from {{A1}}] O\nwhere ((O.value as Quantity) < {{D1}} 'kg/m2' and (O.value as Quantity) > {{D2}} 'kg/m2')",
],
["BBMRI_hasSpecimen", "exists [Specimen]"],
["BBMRI_specimen", "exists [Specimen: Code '{{C}}' from {{A1}}]"],
["BBMRI_retrieveSpecimenByType", "(S.type.coding.code contains '{{C}}')"],
[
"BBMRI_retrieveSpecimenByTemperature",
"(S.extension.where(url='https://fhir.bbmri.de/StructureDefinition/StorageTemperature').value.coding.code contains '{{C}}')",
],
[
"BBMRI_retrieveSpecimenBySamplingDate",
"(FHIRHelpers.ToDateTime(S.collection.collected) between {{D1}} and {{D2}})",
],
[
"BBMRI_retrieveSpecimenByFastingStatus",
"(S.collection.fastingStatus.coding.code contains '{{C}}')",
],
[
"BBMRI_samplingDate",
"exists from [Specimen] S\nwhere FHIRHelpers.ToDateTime(S.collection.collected) between {{D1}} and {{D2}}",
],
[
"BBMRI_fastingStatus",
"exists from [Specimen] S\nwhere S.collection.fastingStatus.coding.code contains '{{C}}'",
],
[
"BBMRI_storageTemperature",
"exists from [Specimen] S where (S.extension.where(url='https://fhir.bbmri.de/StructureDefinition/StorageTemperature').value.coding contains Code '{{C}}' from {{A1}})",
],
]);

export const criterionMap = new Map<string, { type: string; alias?: string[] }>(
Expand Down Expand Up @@ -309,5 +387,43 @@ export const criterionMap = new Map<string, { type: string; alias?: string[] }>(
["75186-7", { type: "observation", alias: ["loinc", "vitalstatuscs"] }], //Vitalstatus
//["Organization", {type: "Organization"}],
["Organization", { type: "department" }],

["BBMRI_gender", { type: "BBMRI_gender" }],
[
"BBMRI_diagnosis",
{
type: "BBMRI_conditionSampleDiagnosis",
alias: ["BBMRI_icd10", "BBMRI_icd10gm"],
},
],
[
"BBMRI_body_weight",
{ type: "BBMRI_observationBodyWeight", alias: ["loinc"] },
], //Body weight
["BBMRI_bmi", { type: "BBMRI_observationBMI", alias: ["loinc"] }], //BMI
[
"BBMRI_smoking_status",
{ type: "BBMRI_observationSmoker", alias: ["loinc"] },
], //Smoking habit
["BBMRI_donor_age", { type: "BBMRI_age" }],
["BBMRI_date_of_diagnosis", { type: "BBMRI_conditionRangeDate" }],
[
"BBMRI_sample_kind",
{ type: "BBMRI_specimen", alias: ["BBMRI_SampleMaterialType"] },
],
[
"BBMRI_storage_temperature",
{
type: "BBMRI_storageTemperature",
alias: ["BBMRI_StorageTemperature"],
},
],
["BBMRI_pat_with_samples", { type: "BBMRI_hasSpecimen" }],
["BBMRI_diagnosis_age_donor", { type: "BBMRI_conditionRangeAge" }],
[
"BBMRI_fasting_status",
{ type: "BBMRI_fastingStatus", alias: ["loinc"] },
],
["BBMRI_sampling_date", { type: "BBMRI_samplingDate" }],
],
);
Loading