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

fix: icd10 replacement of subcodes #70

Merged
merged 1 commit into from
Mar 21, 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
2 changes: 1 addition & 1 deletion packages/demo/public/catalogues/catalogue-dktk.json
Original file line number Diff line number Diff line change
Expand Up @@ -4808,7 +4808,7 @@
[
{
"value": "diagnosis",
"name": "C91.1"
"name": "C91.1%"
}
],
[
Expand Down
21 changes: 20 additions & 1 deletion packages/lib/src/cql-translator-service/ast-to-cql-translator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ const getSingleton = (criterion: AstBottomLayerValue): string => {
case "TNMc": {
if (typeof criterion.value === "string") {
// TODO: Check if we really need to do this or we can somehow tell cql to do that expansion it self
if (criterion.value.slice(-1) === "%") {
if (
criterion.value.slice(-1) === "%" &&
criterion.value.length == 5
) {
const mykey = criterion.value.slice(0, -2);
if (criteria != undefined) {
const expandedValues = criteria.filter(
Expand All @@ -156,6 +159,22 @@ const getSingleton = (criterion: AstBottomLayerValue): string => {
value: expandedValues,
});
}
} else if (
criterion.value.slice(-1) === "%" &&
criterion.value.length == 6
) {
const mykey = criterion.value.slice(0, -1);
if (criteria != undefined) {
const expandedValues = criteria.filter(
(value) => value.startsWith(mykey),
);
expression += getSingleton({
key: criterion.key,
type: criterion.type,
system: criterion.system,
value: expandedValues,
});
}
} else {
expression += substituteCQLExpression(
criterion.key,
Expand Down
Loading