Skip to content

Commit

Permalink
MAT-7909: Fixed when alias is malformed .. or has spaces or whatever
Browse files Browse the repository at this point in the history
  • Loading branch information
gregory-akins committed Dec 9, 2024
1 parent 4e0095b commit 4dcf12a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
17 changes: 17 additions & 0 deletions src/AceEditor/madie-ace-editor.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,23 @@ describe("synching the cql", () => {
expect(updatedContent.isFhirHelpersAliasChanged).toEqual(true);
});

it("should replace incorrect alias for FHIRHelpers ; multi line file alias has spaces", async () => {
const expectValue =
"library MAT7909TestDefaultAlias version '0.0.000'\n using QICore version '4.1.1'\n include FHIRHelpers version '4.3.000' called FHIRHelpers Helpers\n valueset \"Bicarbonate lab test\": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.139'\n context Patient\n define \"Initial Population\": exists ( [Observation] O where O.value < 5 'mg') ";
const updatedContent = await updateEditorContent(
"library MAT7909TestDefaultAlias version '0.0.000'\n using QICore version '4.1.1'\n include FHIRHelpers version '4.3.000' called F Helpers\n valueset \"Bicarbonate lab test\": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.139'\n context Patient\n define \"Initial Population\": exists ( [Observation] O where O.value < 5 'mg') ",
"library MAT7909TestDefaultAlias version '0.0.000'",
"MAT7909TestDefaultAlias",
"",
"0.0.000",
"QI-Core",
"4.1.1",
"measureEditor"
);
expect(updatedContent.cql).toEqual(expectValue);
expect(updatedContent.isFhirHelpersAliasChanged).toEqual(true);
});

it("should replace incorrect alias for FHIRHelpers single line CQL", async () => {
const expectValue =
"library MAT7909TestDefaultAlias version '0.0.000' using QICore version '4.1.1' include FHIRHelpers version '4.3.000' called FHIRHelpers valueset \"Bicarbonate lab test\": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.139' context Patient define \"Initial Population\": exists ( [Observation] O where O.value < 5 'mg') ";
Expand Down
9 changes: 4 additions & 5 deletions src/AceEditor/madie-ace-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,11 @@ const updateCql = (
parsedEditorCql.parsedCql.includes.forEach((include) => {
if (include.name === "FHIRHelpers" && include.called != "FHIRHelpers") {
//then modify and return .. also set cqlUpdates.isFhirHelpersAliasModified = true
const correctFhirHelpersIncludeLine: string = ` FHIRHelpers version ${include.version} called FHIRHelpers`;
const correctFhirHelpersIncludeLine: string = `include FHIRHelpers version ${include.version} called FHIRHelpers`;
const incorrectFhirHelpersIncludeLine: string =

Check failure on line 276 in src/AceEditor/madie-ace-editor.tsx

View workflow job for this annotation

GitHub Actions / Checkout, install, lint, build and test with coverage

Delete `⏎·········`
parsedEditorCql.cqlArrayToBeFiltered[
include.start.line - 1
].substring(include.start.position + 1, include.stop.position + 1);

include.text;
console.log(incorrectFhirHelpersIncludeLine);

Check failure on line 278 in src/AceEditor/madie-ace-editor.tsx

View workflow job for this annotation

GitHub Actions / Checkout, install, lint, build and test with coverage

Unexpected console statement
console.log(correctFhirHelpersIncludeLine);

Check failure on line 279 in src/AceEditor/madie-ace-editor.tsx

View workflow job for this annotation

GitHub Actions / Checkout, install, lint, build and test with coverage

Unexpected console statement
parsedEditorCql.cqlArrayToBeFiltered[include.start.line - 1] =
parsedEditorCql.cqlArrayToBeFiltered[include.start.line - 1].replace(
incorrectFhirHelpersIncludeLine,
Expand Down

0 comments on commit 4dcf12a

Please sign in to comment.