Skip to content

Commit

Permalink
Merge pull request #2 from intersystems-ib/production
Browse files Browse the repository at this point in the history
Updated analysis
  • Loading branch information
isc-lperezra authored Sep 5, 2024
2 parents 5b403f2 + c19c99d commit 7d97491
Show file tree
Hide file tree
Showing 12 changed files with 236 additions and 51 deletions.
52 changes: 28 additions & 24 deletions encoder-ui/src/app/analysis/analysis.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</div>
</div>
<div class="row h-50">
<div class="col-6">
<div class="col-7">
<div class="p-4 h-100">
<label class="font-weight-bold">{{'FINDINGS' | transloco}}:</label>
@if (loading && !error) {
Expand All @@ -56,7 +56,7 @@
</div>
}
@if (!loading && !error) {
<div class="h-100 w-100 border text-section">
<div class="p-2 h-100 w-100 border text-section">
<span class="h-100" [innerHTML]="textUpdated"></span>
</div>
}
Expand All @@ -67,7 +67,7 @@
}
</div>
</div>
<div class="col-6">
<div class="col-5">
<div class="p-4 h-100">
<label class="font-weight-bold">{{'POSSIBLE-DIAGNOSES' | transloco}}:</label>
<div class="h-100 w-100 border text-section">
Expand All @@ -82,36 +82,40 @@
<thead>
<tr>
<th scope="col">{{'TEXT' | transloco}}</th>
<th scope="col">{{'CODE' | transloco}}</th>
<th scope="col">{{'DESCRIPTION' | transloco}}</th>
<th scope="col">{{'SIMILARITY' | transloco}}</th>
<th scope="col">{{'MATCHES' | transloco}}</th>
<th scope="col">{{'ACTION' | transloco}}</th>
</tr>
</thead>
<tbody>
@for (textAndDiagnostic of textAndDiagnosticList; track $index) {
@for (diagnostic of textAndDiagnostic.diagnostics; track diagnostic; let i = $index) {
<tr (mouseover)="markDiagnosis(textAndDiagnostic.rawText)" (mouseout)="unmarkDiagnosis()">
<td>{{textAndDiagnostic.rawText}}</td>
<td>
{{ diagnostic.code }}
</td>
<td>
{{ diagnostic.description }}
</td>
<td [ngClass]="{'similarity-veryhigh': diagnostic.similarity >= .8 ,
'similarity-high': diagnostic.similarity < .8 && diagnostic.similarity >= .7,
'similarity-medium': diagnostic.similarity < .7 && diagnostic.similarity >= .6,
'similarity-low': diagnostic.similarity < .6 }">
{{ diagnostic.similarity }}
</td>
</tr>
}
}
<tr (mouseover)="markDiagnosis(textAndDiagnostic.rawText)" (mouseout)="unmarkDiagnosis()">
<td>{{textAndDiagnostic.rawText}}</td>
<td>{{textAndDiagnostic.diagnostics.length}}</td>
<td>
<button type="button" class="btn btn-success" (click)="open(content, textAndDiagnostic)">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-search" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0"/>
</svg>
</button>
</td>
</tr>
}
</tbody>
</table>
}
</div>
</div>
</div>
</div>
<ng-template #content let-modal>
<div class="modal-header">
<h4 class="modal-title" id="modal-basic-title">{{'SIMILARITIES' | transloco}}: {{diagnosticText}}</h4>
<button type="button" class="btn-close" aria-label="Close" (click)="modal.dismiss('Cross click')"></button>
</div>
<div class="modal-body">
<app-matches-list [diagnostics]="diagnosticsSelected" (newCodeEvent)="modal.close('Code saved')"></app-matches-list>
</div>
<div class="modal-footer">
</div>
</ng-template>
</div>
18 changes: 17 additions & 1 deletion encoder-ui/src/app/analysis/analysis.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { Component, inject, OnInit, TemplateRef } from '@angular/core';
import { IrisService } from '../services/iris.service';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';

interface Diagnostic {
code: String;
Expand All @@ -25,6 +26,7 @@ interface AnalysisText {
})
export class AnalysisComponent implements OnInit{

private modalService = inject(NgbModal);
textUpdated: String = "";
diagnostics: Array<any> = [];
loading = false;
Expand All @@ -39,6 +41,8 @@ export class AnalysisComponent implements OnInit{
textOriginal: string = "";
screenHeight: number = 0;
textToMark: String = "";
diagnosticsSelected: Array<Diagnostic> = [];
diagnosticText: String = "";

constructor(private irisService: IrisService)
{
Expand Down Expand Up @@ -155,4 +159,16 @@ export class AnalysisComponent implements OnInit{
textHTML = textHTML.replace("</mark>","");
this.textUpdated = textHTML;
}

open(content: TemplateRef<any>, textAndDiagnostic: TextAndDiagnostic) {
this.diagnosticText = textAndDiagnostic.rawText;
this.diagnosticsSelected = textAndDiagnostic.diagnostics;
this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title', size: 'xl' }).result.then(
(result) => {
},
(reason) => {

},
);
}
}
48 changes: 26 additions & 22 deletions encoder-ui/src/app/analyzer/analyzer.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</div>
</div>
<div class="row h-50">
<div class="col-6">
<div class="col-7">
<div class="p-4 h-100">
<label class="font-weight-bold">{{'FINDINGS' | transloco}}:</label>
@if (loading && !error) {
Expand All @@ -35,7 +35,7 @@
}
</div>
</div>
<div class="col-6">
<div class="col-5">
<div class="p-4 h-100">
<label class="font-weight-bold">{{'POSSIBLE-DIAGNOSES' | transloco}}:</label>
<div class="h-100 w-100 border text-section">
Expand All @@ -50,30 +50,23 @@
<thead>
<tr>
<th scope="col">{{'TEXT' | transloco}}</th>
<th scope="col">{{'CODE' | transloco}}</th>
<th scope="col">{{'DESCRIPTION' | transloco}}</th>
<th scope="col">{{'SIMILARITY' | transloco}}</th>
<th scope="col">{{'MATCHES' | transloco}}</th>
<th scope="col">{{'ACTION' | transloco}}</th>
</tr>
</thead>
<tbody>
@for (textAndDiagnostic of textAndDiagnosticList; track $index) {
@for (diagnostic of textAndDiagnostic.diagnostics; track diagnostic; let i = $index) {
<tr (mouseover)="markDiagnosis(textAndDiagnostic.rawText)" (mouseout)="unmarkDiagnosis()">
<td>{{textAndDiagnostic.rawText}}</td>
<td>
{{ diagnostic.code }}
</td>
<td>
{{ diagnostic.description }}
</td>
<td [ngClass]="{'similarity-veryhigh': diagnostic.similarity >= .8 ,
'similarity-high': diagnostic.similarity < .8 && diagnostic.similarity >= .7,
'similarity-medium': diagnostic.similarity < .7 && diagnostic.similarity >= .6,
'similarity-low': diagnostic.similarity < .6 }">
{{ diagnostic.similarity }}
</td>
</tr>
}
<tr (mouseover)="markDiagnosis(textAndDiagnostic.rawText)" (mouseout)="unmarkDiagnosis()">
<td>{{textAndDiagnostic.rawText}}</td>
<td>{{textAndDiagnostic.diagnostics.length}}</td>
<td>
<button type="button" class="btn btn-success" (click)="open(content, textAndDiagnostic)">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-search" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0"/>
</svg>
</button>
</td>
</tr>
}
</tbody>
</table>
Expand All @@ -82,4 +75,15 @@
</div>
</div>
</div>
<ng-template #content let-modal>
<div class="modal-header">
<h4 class="modal-title" id="modal-basic-title">{{'SIMILARITIES' | transloco}}: {{diagnosticText}}</h4>
<button type="button" class="btn-close" aria-label="Close" (click)="modal.dismiss('Cross click')"></button>
</div>
<div class="modal-body">
<app-matches-list [diagnostics]="diagnosticsSelected" (newCodeEvent)="modal.close('Code saved')"></app-matches-list>
</div>
<div class="modal-footer">
</div>
</ng-template>
</div>
18 changes: 17 additions & 1 deletion encoder-ui/src/app/analyzer/analyzer.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Component } from '@angular/core';
import { Component, inject, TemplateRef } from '@angular/core';
import { UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';
import { IrisService } from '../services/iris.service';
import { TranslocoService } from '@ngneat/transloco';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';

interface Diagnostic {
code: String;
Expand All @@ -22,12 +23,15 @@ interface TextAndDiagnostic {

export class AnalyzerComponent {

private modalService = inject(NgbModal);
textUpdated = "";
diagnostics: Array<any> = [];
loading = false;
error = false;
totalReceived = 0;
textAndDiagnosticList: Array<TextAndDiagnostic> = [];
diagnosticsSelected: Array<Diagnostic> = [];
diagnosticText: String = "";

constructor(private irisService: IrisService,
private translocoService: TranslocoService
Expand Down Expand Up @@ -161,4 +165,16 @@ export class AnalyzerComponent {
textHTML = textHTML.replace("</mark>","");
this.textUpdated = textHTML;
}

open(content: TemplateRef<any>, textAndDiagnostic: TextAndDiagnostic) {
this.diagnosticText = textAndDiagnostic.rawText;
this.diagnosticsSelected = textAndDiagnostic.diagnostics;
this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title', size: 'xl' }).result.then(
(result) => {
},
(reason) => {

},
);
}
}
2 changes: 2 additions & 0 deletions encoder-ui/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { AnalysisComponent } from './analysis/analysis.component';
import { FunctionsPipe } from './utils/functions.pipe';
import { LoaderComponent } from './loader/loader.component';
import { TranslocoRootModule } from './transloco-root.module';
import { MatchesListComponent } from './matches-list/matches-list.component';

@NgModule({
declarations: [
Expand All @@ -22,6 +23,7 @@ import { TranslocoRootModule } from './transloco-root.module';
AnalyzerComponent,
AnalysisComponent,
LoaderComponent,
MatchesListComponent,
FunctionsPipe
],
imports: [
Expand Down
53 changes: 53 additions & 0 deletions encoder-ui/src/app/matches-list/matches-list.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
@if (loading) {
<div class="d-flex justify-content-center">
<div class="spinner-border" role="status">
</div>
</div>
}
@if (!loading) {
<table class="table table-striped table-hover">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">{{'ICD-CODE' | transloco}}</th>
<th scope="col">{{'DESCRIPTION' | transloco}}</th>
<th scope="col">{{'SIMILARITY' | transloco}}</th>
</tr>
</thead>
<tbody>
@for (diagnostic of diagnosticsPage; track diagnostic; let i = $index) {
<tr>
<th scope="row">{{ i + 1 }}</th>
<td>
{{ diagnostic.code }}
</td>
<td>
{{ diagnostic.description }}
</td>
<td [ngClass]="{'similarity-veryhigh': diagnostic.similarity >= .8 ,
'similarity-high': diagnostic.similarity < .8 && diagnostic.similarity >= .7,
'similarity-medium': diagnostic.similarity < .7 && diagnostic.similarity >= .6,
'similarity-low': diagnostic.similarity < .6 }">
{{ diagnostic.similarity }}
</td>
</tr>
}
</tbody>
</table>

<div class="d-flex justify-content-between p-2">
<ngb-pagination
[collectionSize]="collectionSize"
[(page)]="page"
[pageSize]="pageSize"
(pageChange)="refreshOptions()"
>
</ngb-pagination>

<select class="form-select" style="width: auto" [(ngModel)]="pageSize" (ngModelChange)="refreshOptions()">
<option [ngValue]="6">6 {{'CODES-PAGE' | transloco}}</option>
<option [ngValue]="8">8 {{'CODES-PAGE' | transloco}}</option>
<option [ngValue]="10" selected>10 {{'CODES-PAGE' | transloco}}</option>
</select>
</div>
}
16 changes: 16 additions & 0 deletions encoder-ui/src/app/matches-list/matches-list.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.similarity-veryhigh {
background-color: #27AE60;
color: white;
}
.similarity-high {
background-color: #46C84E;
color: white;
}
.similarity-medium {
background-color: #FFC300;
color: black;
}
.similarity-low {
background-color: #FF5733;
color: black;
}
23 changes: 23 additions & 0 deletions encoder-ui/src/app/matches-list/matches-list.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { MatchesListComponent } from './matches-list.component';

describe('MatchesListComponent', () => {
let component: MatchesListComponent;
let fixture: ComponentFixture<MatchesListComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [MatchesListComponent]
})
.compileComponents();

fixture = TestBed.createComponent(MatchesListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Loading

0 comments on commit 7d97491

Please sign in to comment.