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

chore: changed stratifier to dktk sample centric search #163

Merged
merged 5 commits into from
Jan 28, 2025
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
4 changes: 2 additions & 2 deletions packages/demo/src/AppCCP.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
dktkMedicationStatementsMeasure,
dktkPatientsMeasure,
dktkProceduresMeasure,
dktkSpecimenMeasure,
dktkSpecificSpecimenMeasure,
dktkHistologyMeasure,
} from "./measures";

Expand Down Expand Up @@ -65,7 +65,7 @@
measures: [
dktkPatientsMeasure as MeasureItem,
dktkDiagnosisMeasure as MeasureItem,
dktkSpecimenMeasure as MeasureItem,
dktkSpecificSpecimenMeasure as MeasureItem,
dktkProceduresMeasure as MeasureItem,
dktkMedicationStatementsMeasure as MeasureItem,
dktkHistologyMeasure as MeasureItem,
Expand Down
5 changes: 0 additions & 5 deletions packages/demo/src/backends/ast-to-cql-translator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,8 @@ 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 @@ -125,8 +122,6 @@ 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
63 changes: 0 additions & 63 deletions packages/demo/src/backends/cqlquery-mappings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,69 +207,6 @@ 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
46 changes: 45 additions & 1 deletion packages/demo/src/measures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,50 @@ DKTK_STRAT_SPECIMEN_STRATIFIER
`,
};

export const dktkSpecificSpecimenMeasure = {
key: "specimen",
measure: {
code: {
text: "specimen",
},
extension: [
{
url: "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-populationBasis",
valueCode: "Specimen",
},
],
population: [
{
code: {
coding: [
{
system: "http://terminology.hl7.org/CodeSystem/measure-population",
code: "initial-population",
},
],
},
criteria: {
language: "text/cql-identifier",
expression: "Specimen",
},
},
],
stratifier: [
{
code: {
text: "sample_kind",
},
criteria: {
language: "text/cql",
expression: "SampleType",
},
},
],
},
cql: `
DKTK_REPLACE_SPECIMEN_STRATIFIER`,
};

export const dktkProceduresMeasure = {
key: "procedures",
measure: {
Expand Down Expand Up @@ -1044,6 +1088,6 @@ export const dktkHistologyMeasure = {
],
},
cql: `
DKTK_STRAT_HISTOLOGY_STRATIFIER
DKTK_REPLACE_HISTOLOGY_STRATIFIER
`,
};
25 changes: 15 additions & 10 deletions packages/lib/src/components/results/ChartComponent.wc.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -271,16 +271,21 @@
valueToAccumulate.values,
catalogueGroupCode,
);

combinedSubGroupData.data.push(aggregationCount);
combinedSubGroupData.labels.push(valueToAccumulate.name);

for (let i = 0; i < combinedSubGroupData.labels.length; i++) {
const element: string = combinedSubGroupData.labels[i];
if (valueToAccumulate.values.includes(element)) {
combinedSubGroupData.labels.splice(i, 1);
combinedSubGroupData.data.splice(i, 1);
i--;
if (aggregationCount > 0) {
combinedSubGroupData.data.push(aggregationCount);
combinedSubGroupData.labels.push(valueToAccumulate.name);

for (
let i = 0;
i < combinedSubGroupData.labels.length;
i++
) {
const element: string = combinedSubGroupData.labels[i];
if (valueToAccumulate.values.includes(element)) {
combinedSubGroupData.labels.splice(i, 1);
combinedSubGroupData.data.splice(i, 1);
i--;
}
}
}
});
Expand Down
Loading