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

Highlighting compliance #301

Merged
merged 6 commits into from
Apr 9, 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
24 changes: 14 additions & 10 deletions src/calculation/HTMLBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,31 @@
'background-color': '#ccebe0',
color: '#20744c',
'border-bottom-color': '#20744c',
'border-bottom-style': 'solid'
'border-bottom-style': 'solid',
'border-bottom-width': '0.35em'
};

export const cqlLogicClauseFalseStyle = {
'background-color': '#edd8d0',
color: '#a63b12',
'border-bottom-color': '#a63b12',
'border-bottom-style': 'double'
'border-bottom-style': 'double',
'border-bottom-width': '0.35em'
};

export const cqlLogicClauseCoveredStyle = {
'background-color': '#daeaf5',
color: '#004e82',
'border-bottom-color': '#006cb4',
'border-bottom-style': 'dashed'
color: '#004e82'
};

export const cqlLogicUncoveredClauseStyle = {
'background-color': 'white',
color: 'black',
'border-bottom-color': 'white',
'border-bottom-style': 'solid'
color: 'black'
};

export const cqlLogicUncoveredUncoverageClauseStyle = {
'background-color': '#edd8d0',
color: '#a63b12'
};

/**
Expand Down Expand Up @@ -96,13 +99,13 @@
Handlebars.registerHelper('highlightUncoverage', (localId, context) => {
const libraryName: string = context.data.root.libraryName;

if (
(context.data.root.uncoveredClauses as ClauseResult[]).some(
result => result.libraryName === libraryName && result.localId === localId
)
) {
// Mark with red styling if clause is found in uncoverage list
return objToCSS(cqlLogicClauseFalseStyle);
return objToCSS(cqlLogicUncoveredUncoverageClauseStyle);

Check warning on line 108 in src/calculation/HTMLBuilder.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
} else if (
(context.data.root.coveredClauses as ClauseResult[]).some(
result => result.libraryName === libraryName && result.localId === localId
Expand Down Expand Up @@ -211,7 +214,8 @@
libraryName: s.libraryName,
statementName: s.statementName,
clauseResults: clauseResults,
...matchingExpression.annotation[0].s
...matchingExpression.annotation[0].s,
highlightLogic: true
});
overallHTML += statementHTML;
if (options?.buildStatementLevelHTML) {
Expand Down
2 changes: 1 addition & 1 deletion src/templates/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default `<pre style="tab-size: 2; border-bottom-width: 4px; line-height: 1.4"
export default `<pre style="tab-size: 2 {{~#if @root.highlightLogic~}}; line-height: 1.51em{{~/if~}}"
data-library-name="{{ libraryName }}" data-statement-name="{{ statementName }}">
<code>
{{> clause}}
Expand Down
14 changes: 7 additions & 7 deletions test/unit/fixtures/html/simpleCoverageAnnotation.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<div>
<h2>test Clause Coverage: 100%</h2>
<pre
style="tab-size: 2; border-bottom-width: 4px; line-height: 1.4"
style="tab-size: 2"
data-library-name="AnticoagulationTherapyforAtrialFibrillationFlutter"
data-statement-name="Denominator"
>
<code>
<span data-ref-id="119" style="background-color:#daeaf5;color:#004e82;border-bottom-color:#006cb4;border-bottom-style:dashed">
<span data-ref-id="119" style="background-color:#daeaf5;color:#004e82">
<span>define &quot;Denominator&quot;: </span>
<span data-ref-id="118" style="background-color:white;color:black;border-bottom-color:white;border-bottom-style:solid">
<span data-ref-id="116" style="background-color:white;color:black;border-bottom-color:white;border-bottom-style:solid">
<span data-ref-id="101" style="background-color:white;color:black;border-bottom-color:white;border-bottom-style:solid">
<span data-ref-id="118" style="background-color:white;color:black">
<span data-ref-id="116" style="background-color:white;color:black">
<span data-ref-id="101" style="background-color:white;color:black">
<span>&quot;Encounter with Atrial Ablation Procedure&quot;</span>
</span>
<span>union</span>
<span data-ref-id="115" style="background-color:white;color:black;border-bottom-color:white;border-bottom-style:solid">
<span data-ref-id="115" style="background-color:white;color:black">
<span>&quot;History of Atrial FibrillationFlutter&quot;</span>
</span>
</span>
<span>union</span>
<span data-ref-id="117" style="background-color:white;color:black;border-bottom-color:white;border-bottom-style:solid">
<span data-ref-id="117" style="background-color:white;color:black">
<span>&quot;Current Diagnosis Atrial FibrillationFlutter&quot;</span>
</span>
</span>
Expand Down
14 changes: 7 additions & 7 deletions test/unit/fixtures/html/simpleCoverageAnnotation2.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<div>
<h2>test2 Clause Coverage: 100%</h2>
<pre
style="tab-size: 2; border-bottom-width: 4px; line-height: 1.4"
style="tab-size: 2"
data-library-name="AnticoagulationTherapyforAtrialFibrillationFlutter"
data-statement-name="Denominator"
>
<code>
<span data-ref-id="119" style="background-color:#daeaf5;color:#004e82;border-bottom-color:#006cb4;border-bottom-style:dashed">
<span data-ref-id="119" style="background-color:#daeaf5;color:#004e82">
<span>define &quot;Denominator&quot;: </span>
<span data-ref-id="118" style="background-color:white;color:black;border-bottom-color:white;border-bottom-style:solid">
<span data-ref-id="116" style="background-color:white;color:black;border-bottom-color:white;border-bottom-style:solid">
<span data-ref-id="101" style="background-color:white;color:black;border-bottom-color:white;border-bottom-style:solid">
<span data-ref-id="118" style="background-color:white;color:black">
<span data-ref-id="116" style="background-color:white;color:black">
<span data-ref-id="101" style="background-color:white;color:black">
<span>&quot;Encounter with Atrial Ablation Procedure&quot;</span>
</span>
<span>union</span>
<span data-ref-id="115" style="background-color:white;color:black;border-bottom-color:white;border-bottom-style:solid">
<span data-ref-id="115" style="background-color:white;color:black">
<span>&quot;History of Atrial FibrillationFlutter&quot;</span>
</span>
</span>
<span>union</span>
<span data-ref-id="117" style="background-color:white;color:black;border-bottom-color:white;border-bottom-style:solid">
<span data-ref-id="117" style="background-color:white;color:black">
<span>&quot;Current Diagnosis Atrial FibrillationFlutter&quot;</span>
</span>
</span>
Expand Down
4 changes: 2 additions & 2 deletions test/unit/fixtures/html/simpleFalseAnnotation.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<div>
<h2>Population Group: test</h2>
<pre
style="tab-size: 2; border-bottom-width: 4px; line-height: 1.4"
style="tab-size: 2; line-height: 1.51em"
data-library-name="AnticoagulationTherapyforAtrialFibrillationFlutter"
data-statement-name="Denominator"
>
<code>
<span data-ref-id="119" style="background-color:#edd8d0; color:#a63b12; border-bottom-color:#a63b12; border-bottom-style:double">
<span data-ref-id="119" style="background-color:#edd8d0; color:#a63b12; border-bottom-color:#a63b12; border-bottom-style:double;border-bottom-width:0.35em">
<span>define &quot;Denominator&quot;: </span>
<span data-ref-id="118" style="">
<span data-ref-id="116" style="">
Expand Down
4 changes: 2 additions & 2 deletions test/unit/fixtures/html/simpleTrueAnnotation.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<div>
<h2>Population Group: test</h2>
<pre
style="tab-size: 2; border-bottom-width: 4px; line-height: 1.4"
style="tab-size: 2; line-height: 1.51em"
data-library-name="AnticoagulationTherapyforAtrialFibrillationFlutter"
data-statement-name="Denominator"
>
<code>
<span data-ref-id="119" style="background-color:#ccebe0;color:#20744c;border-bottom-color:#20744c;border-bottom-style:solid">
<span data-ref-id="119" style="background-color:#ccebe0;color:#20744c;border-bottom-color:#20744c;border-bottom-style:solid;border-bottom-width:0.35em">
<span>define &quot;Denominator&quot;: </span>
<span data-ref-id="118" style="">
<span data-ref-id="116" style="">
Expand Down
Loading