From 0397a2f0cbb2b761fc710e2dc57274fbf30a6ce8 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Thu, 3 Aug 2023 20:03:24 -0700 Subject: [PATCH] sort all resources by "sort_date" column during query return units when querying rename all usages of "source" page to "explore" adding new explore page. fix dashboard widgets to correctly --- .../pkg/database/sqlite_repository_query.go | 1 + .../pkg/web/handler/dashboard/default.json | 8 +- frontend/src/app/app-routing.module.ts | 11 ++- frontend/src/app/app.module.ts | 2 + .../fhir/common/table/table.component.html | 2 +- .../allergy-intolerance.component.html | 2 +- .../diagnostic-report.component.html | 2 +- .../document-reference.component.html | 2 +- .../immunization/immunization.component.html | 2 +- .../fhir/resources/media/media.component.html | 2 +- .../medication-request.component.html | 2 +- .../medication/medication.component.html | 2 +- .../practitioner/practitioner.component.html | 2 +- .../procedure/procedure.component.html | 2 +- .../report-labs-observation.component.html | 4 +- .../pages/dashboard/dashboard.component.ts | 2 +- .../app/pages/explore/explore.component.html | 73 +++++++++++++++++++ .../app/pages/explore/explore.component.scss | 0 .../pages/explore/explore.component.spec.ts | 23 ++++++ .../app/pages/explore/explore.component.ts | 62 ++++++++++++++++ .../resource-detail.component.html | 2 +- .../source-detail.component.html | 2 +- .../pipes/dataset-latest-entry.pipe.spec.ts | 8 ++ .../app/pipes/dataset-latest-entry.pipe.ts | 44 +++++++++++ frontend/src/app/pipes/pipes.module.ts | 5 +- .../dashboard-widget.component.ts | 20 ----- .../grouped-bar-chart-widget.component.html | 2 +- .../grouped-bar-chart-widget.component.ts | 3 +- .../simple-line-chart-widget.component.html | 2 +- .../simple-line-chart-widget.component.ts | 3 +- 30 files changed, 252 insertions(+), 45 deletions(-) create mode 100644 frontend/src/app/pages/explore/explore.component.html create mode 100644 frontend/src/app/pages/explore/explore.component.scss create mode 100644 frontend/src/app/pages/explore/explore.component.spec.ts create mode 100644 frontend/src/app/pages/explore/explore.component.ts create mode 100644 frontend/src/app/pipes/dataset-latest-entry.pipe.spec.ts create mode 100644 frontend/src/app/pipes/dataset-latest-entry.pipe.ts diff --git a/backend/pkg/database/sqlite_repository_query.go b/backend/pkg/database/sqlite_repository_query.go index 208da505e..471b1f967 100644 --- a/backend/pkg/database/sqlite_repository_query.go +++ b/backend/pkg/database/sqlite_repository_query.go @@ -113,6 +113,7 @@ func (sr *SqliteRepository) QueryResources(ctx context.Context, query models.Que Select(fmt.Sprintf("%s.*", TABLE_ALIAS)). Where(strings.Join(whereClauses, " AND "), whereNamedParameters). Group(fmt.Sprintf("%s.id", TABLE_ALIAS)). + Order(fmt.Sprintf("%s.sort_date asc", TABLE_ALIAS)). Table(strings.Join(fromClauses, ", ")). Find(&results) diff --git a/backend/pkg/web/handler/dashboard/default.json b/backend/pkg/web/handler/dashboard/default.json index 36fdeb4f6..a0ceaa2ef 100644 --- a/backend/pkg/web/handler/dashboard/default.json +++ b/backend/pkg/web/handler/dashboard/default.json @@ -25,6 +25,7 @@ "q": { "select": [ "valueQuantity.value as data", + "valueQuantity.unit as unit", "(effectiveDateTime | issued).first() as label" ], "from": "Observation", @@ -50,6 +51,7 @@ "q": { "select": [ "valueQuantity.value as data", + "valueQuantity.unit as unit", "(effectiveDateTime | issued).first() as label" ], "from": "Observation", @@ -75,7 +77,8 @@ { "q": { "select": [ - "component.where(code.coding.system = 'http://loinc.org' and code.coding.code = '8462-4').valueQuantity.value as data" + "component.where(code.coding.system = 'http://loinc.org' and code.coding.code = '8462-4').valueQuantity.value as data", + "component.where(code.coding.system = 'http://loinc.org' and code.coding.code = '8462-4').valueQuantity.unit as unit" ], "from": "Observation", "where": { @@ -89,7 +92,8 @@ { "q": { "select": [ - "component.where(code.coding.system = 'http://loinc.org' and code.coding.code = '8480-6').valueQuantity.value as data" + "component.where(code.coding.system = 'http://loinc.org' and code.coding.code = '8480-6').valueQuantity.value as data", + "component.where(code.coding.system = 'http://loinc.org' and code.coding.code = '8480-6').valueQuantity.unit as unit" ], "from": "Observation", "where": { diff --git a/frontend/src/app/app-routing.module.ts b/frontend/src/app/app-routing.module.ts index 3c349a7dd..211a21fb7 100644 --- a/frontend/src/app/app-routing.module.ts +++ b/frontend/src/app/app-routing.module.ts @@ -13,6 +13,7 @@ import {PatientProfileComponent} from './pages/patient-profile/patient-profile.c import {MedicalHistoryComponent} from './pages/medical-history/medical-history.component'; import {ReportLabsComponent} from './pages/report-labs/report-labs.component'; import {ResourceCreatorComponent} from './pages/resource-creator/resource-creator.component'; +import {ExploreComponent} from './pages/explore/explore.component'; const routes: Routes = [ @@ -23,9 +24,13 @@ const routes: Routes = [ { path: '', redirectTo: '/dashboard', pathMatch: 'full' }, { path: 'dashboard', component: DashboardComponent, canActivate: [ IsAuthenticatedAuthGuard] }, - { path: 'source/:source_id', component: SourceDetailComponent, canActivate: [ IsAuthenticatedAuthGuard] }, - { path: 'source/:source_id/resource/:resource_id', component: ResourceDetailComponent, canActivate: [ IsAuthenticatedAuthGuard] }, - { path: 'source/:source_id/resource/:resource_type/:resource_id', component: ResourceDetailComponent, canActivate: [ IsAuthenticatedAuthGuard] }, + + //explore page will replace source/* pages + { path: 'explore', component: ExploreComponent, canActivate: [ IsAuthenticatedAuthGuard] }, + { path: 'explore/:source_id', component: SourceDetailComponent, canActivate: [ IsAuthenticatedAuthGuard] }, + { path: 'explore/:source_id/resource/:resource_id', component: ResourceDetailComponent, canActivate: [ IsAuthenticatedAuthGuard] }, + { path: 'explore/:source_id/resource/:resource_type/:resource_id', component: ResourceDetailComponent, canActivate: [ IsAuthenticatedAuthGuard] }, + { path: 'sources', component: MedicalSourcesComponent, canActivate: [ IsAuthenticatedAuthGuard] }, { path: 'sources/callback/:source_type', component: MedicalSourcesComponent, canActivate: [ IsAuthenticatedAuthGuard] }, { path: 'resource/create', component: ResourceCreatorComponent, canActivate: [ IsAuthenticatedAuthGuard] }, diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index cbd5085e2..b76715c9b 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -34,6 +34,7 @@ import { InfiniteScrollModule } from 'ngx-infinite-scroll'; import { NgSelectModule } from '@ng-select/ng-select'; import {HTTP_CLIENT_TOKEN} from "./dependency-injection"; import {WidgetsModule} from './widgets/widgets.module'; +import { ExploreComponent } from './pages/explore/explore.component'; @NgModule({ declarations: [ @@ -50,6 +51,7 @@ import {WidgetsModule} from './widgets/widgets.module'; MedicalHistoryComponent, ReportLabsComponent, ResourceCreatorComponent, + ExploreComponent, ], imports: [ FormsModule, diff --git a/frontend/src/app/components/fhir/common/table/table.component.html b/frontend/src/app/components/fhir/common/table/table.component.html index 5502a13c2..6363e9bbd 100644 --- a/frontend/src/app/components/fhir/common/table/table.component.html +++ b/frontend/src/app/components/fhir/common/table/table.component.html @@ -19,7 +19,7 @@ - {{rowItem.data.display}} + {{rowItem.data.display}} {{rowItem.data}} diff --git a/frontend/src/app/components/fhir/resources/allergy-intolerance/allergy-intolerance.component.html b/frontend/src/app/components/fhir/resources/allergy-intolerance/allergy-intolerance.component.html index 7a51c2ca2..5dad97f0d 100644 --- a/frontend/src/app/components/fhir/resources/allergy-intolerance/allergy-intolerance.component.html +++ b/frontend/src/app/components/fhir/resources/allergy-intolerance/allergy-intolerance.component.html @@ -11,6 +11,6 @@
{{displayModel?.title}}
diff --git a/frontend/src/app/components/fhir/resources/diagnostic-report/diagnostic-report.component.html b/frontend/src/app/components/fhir/resources/diagnostic-report/diagnostic-report.component.html index 752144482..8c423e75b 100644 --- a/frontend/src/app/components/fhir/resources/diagnostic-report/diagnostic-report.component.html +++ b/frontend/src/app/components/fhir/resources/diagnostic-report/diagnostic-report.component.html @@ -16,7 +16,7 @@
{{displayModel?.title}}
diff --git a/frontend/src/app/components/fhir/resources/document-reference/document-reference.component.html b/frontend/src/app/components/fhir/resources/document-reference/document-reference.component.html index 9bb8de794..215068630 100644 --- a/frontend/src/app/components/fhir/resources/document-reference/document-reference.component.html +++ b/frontend/src/app/components/fhir/resources/document-reference/document-reference.component.html @@ -20,6 +20,6 @@
{{displayModel?.category?.text}}
diff --git a/frontend/src/app/components/fhir/resources/immunization/immunization.component.html b/frontend/src/app/components/fhir/resources/immunization/immunization.component.html index f159a210a..a2e4b253f 100644 --- a/frontend/src/app/components/fhir/resources/immunization/immunization.component.html +++ b/frontend/src/app/components/fhir/resources/immunization/immunization.component.html @@ -16,6 +16,6 @@
{{displayModel?.title}}
diff --git a/frontend/src/app/components/fhir/resources/media/media.component.html b/frontend/src/app/components/fhir/resources/media/media.component.html index 03ea7dfd4..e9dab111f 100644 --- a/frontend/src/app/components/fhir/resources/media/media.component.html +++ b/frontend/src/app/components/fhir/resources/media/media.component.html @@ -20,6 +20,6 @@
{{displayModel?.sort_title}}
diff --git a/frontend/src/app/components/fhir/resources/medication-request/medication-request.component.html b/frontend/src/app/components/fhir/resources/medication-request/medication-request.component.html index 25a337128..f792aca50 100644 --- a/frontend/src/app/components/fhir/resources/medication-request/medication-request.component.html +++ b/frontend/src/app/components/fhir/resources/medication-request/medication-request.component.html @@ -16,7 +16,7 @@
{{displayModel?.display}}
diff --git a/frontend/src/app/components/fhir/resources/medication/medication.component.html b/frontend/src/app/components/fhir/resources/medication/medication.component.html index e34a7c22b..20f72813b 100644 --- a/frontend/src/app/components/fhir/resources/medication/medication.component.html +++ b/frontend/src/app/components/fhir/resources/medication/medication.component.html @@ -16,7 +16,7 @@
{{displayModel?.title?.display}}
diff --git a/frontend/src/app/components/fhir/resources/practitioner/practitioner.component.html b/frontend/src/app/components/fhir/resources/practitioner/practitioner.component.html index 310d637b0..e6bb86a5b 100644 --- a/frontend/src/app/components/fhir/resources/practitioner/practitioner.component.html +++ b/frontend/src/app/components/fhir/resources/practitioner/practitioner.component.html @@ -16,6 +16,6 @@
{{displayModel?.sort_title}}
diff --git a/frontend/src/app/components/fhir/resources/procedure/procedure.component.html b/frontend/src/app/components/fhir/resources/procedure/procedure.component.html index 533606b60..09d240c53 100644 --- a/frontend/src/app/components/fhir/resources/procedure/procedure.component.html +++ b/frontend/src/app/components/fhir/resources/procedure/procedure.component.html @@ -16,7 +16,7 @@
{{displayModel?.display}}
diff --git a/frontend/src/app/components/report-labs-observation/report-labs-observation.component.html b/frontend/src/app/components/report-labs-observation/report-labs-observation.component.html index 367db7672..e8e1186f5 100644 --- a/frontend/src/app/components/report-labs-observation/report-labs-observation.component.html +++ b/frontend/src/app/components/report-labs-observation/report-labs-observation.component.html @@ -3,7 +3,7 @@
- {{observationTitle}} + {{observationTitle}}
{{firstObservation | fhirPath: "Observation.effectiveDateTime": "Observation.issued" | date}} @@ -36,7 +36,7 @@
    -
  • Observation: {{observation | fhirPath: "Observation.effectiveDateTime": "Observation.issued" | date}}
  • +
  • Observation: {{observation | fhirPath: "Observation.effectiveDateTime": "Observation.issued" | date}}
diff --git a/frontend/src/app/pages/dashboard/dashboard.component.ts b/frontend/src/app/pages/dashboard/dashboard.component.ts index 5b159d49c..7863474db 100644 --- a/frontend/src/app/pages/dashboard/dashboard.component.ts +++ b/frontend/src/app/pages/dashboard/dashboard.component.ts @@ -76,7 +76,7 @@ export class DashboardComponent implements OnInit { } selectSource(selectedSource: Source){ - this.router.navigateByUrl(`/source/${selectedSource.id}`, { + this.router.navigateByUrl(`/explore/${selectedSource.id}`, { state: selectedSource }); } diff --git a/frontend/src/app/pages/explore/explore.component.html b/frontend/src/app/pages/explore/explore.component.html new file mode 100644 index 000000000..db07d0bfe --- /dev/null +++ b/frontend/src/app/pages/explore/explore.component.html @@ -0,0 +1,73 @@ +
+
+
+ + + + + + + +
+ +
+
+ + +
+ +
+
+ + +
+
+ +
+
+
+ + + + + + + + + +
+
+
diff --git a/frontend/src/app/pages/explore/explore.component.scss b/frontend/src/app/pages/explore/explore.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/frontend/src/app/pages/explore/explore.component.spec.ts b/frontend/src/app/pages/explore/explore.component.spec.ts new file mode 100644 index 000000000..b74ed89ca --- /dev/null +++ b/frontend/src/app/pages/explore/explore.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ExploreComponent } from './explore.component'; + +describe('ExploreComponent', () => { + let component: ExploreComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ ExploreComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(ExploreComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/frontend/src/app/pages/explore/explore.component.ts b/frontend/src/app/pages/explore/explore.component.ts new file mode 100644 index 000000000..221093f34 --- /dev/null +++ b/frontend/src/app/pages/explore/explore.component.ts @@ -0,0 +1,62 @@ +import { Component, OnInit } from '@angular/core'; +import {FastenApiService} from '../../services/fasten-api.service'; +import {NgbModal} from '@ng-bootstrap/ng-bootstrap'; +import {Source} from '../../models/fasten/source'; +import {forkJoin} from 'rxjs'; +import {LighthouseService} from '../../services/lighthouse.service'; +import {SourceListItem} from '../medical-sources/medical-sources.component'; +import {Router} from '@angular/router'; + +@Component({ + selector: 'app-explore', + templateUrl: './explore.component.html', + styleUrls: ['./explore.component.scss'] +}) +export class ExploreComponent implements OnInit { + loading: boolean = false + connectedSources: SourceListItem[] = [] + constructor( + private fastenApi: FastenApiService, + private lighthouseApi: LighthouseService, + private router: Router + ) { } + + ngOnInit(): void { + this.loading = true + this.fastenApi.getSources().subscribe(results => { + this.loading = false + + //handle connected sources sources + const connectedSources = results as Source[] + forkJoin(connectedSources.map((source) => this.lighthouseApi.getLighthouseSource(source.source_type))).subscribe((connectedMetadata) => { + for(const ndx in connectedSources){ + this.connectedSources.push({source: connectedSources[ndx], metadata: connectedMetadata[ndx]}) + } + }) + }, error => { + this.loading = false + }) + + } + + public exploreSource(sourceListItem: SourceListItem, ) { + this.router.navigateByUrl(`/source/${sourceListItem.source.id}`, { + state: sourceListItem.source + }); + + // if(this.status[sourceListItem.metadata.source_type] || !sourceListItem.source){ + // //if this source is currently "loading" dont open the modal window + // return + // } + // + // this.modalSelectedSourceListItem = sourceListItem + // this.modalService.open(contentModalRef, {ariaLabelledBy: 'modal-basic-title'}).result.then((result) => { + // this.modalSelectedSourceListItem = null + // this.modalCloseResult = `Closed with: ${result}`; + // }, (reason) => { + // this.modalSelectedSourceListItem = null + // this.modalCloseResult = `Dismissed ${this.getDismissReason(reason)}`; + // }); + } + +} diff --git a/frontend/src/app/pages/resource-detail/resource-detail.component.html b/frontend/src/app/pages/resource-detail/resource-detail.component.html index 4f4029e11..0038a53ec 100644 --- a/frontend/src/app/pages/resource-detail/resource-detail.component.html +++ b/frontend/src/app/pages/resource-detail/resource-detail.component.html @@ -2,7 +2,7 @@
- {{sourceName}} + {{sourceName}} Resource {{resource?.source_resource_type}} {{resource?.source_resource_id}} diff --git a/frontend/src/app/pages/source-detail/source-detail.component.html b/frontend/src/app/pages/source-detail/source-detail.component.html index 3e68e5f91..a6b6bd80f 100644 --- a/frontend/src/app/pages/source-detail/source-detail.component.html +++ b/frontend/src/app/pages/source-detail/source-detail.component.html @@ -18,7 +18,7 @@

{{getPatientName()}}

diff --git a/frontend/src/app/pipes/dataset-latest-entry.pipe.spec.ts b/frontend/src/app/pipes/dataset-latest-entry.pipe.spec.ts new file mode 100644 index 000000000..694584426 --- /dev/null +++ b/frontend/src/app/pipes/dataset-latest-entry.pipe.spec.ts @@ -0,0 +1,8 @@ +import { DatasetLatestEntryPipe } from './dataset-latest-entry.pipe'; + +describe('DatasetLatestEntryPipe', () => { + it('create an instance', () => { + const pipe = new DatasetLatestEntryPipe(); + expect(pipe).toBeTruthy(); + }); +}); diff --git a/frontend/src/app/pipes/dataset-latest-entry.pipe.ts b/frontend/src/app/pipes/dataset-latest-entry.pipe.ts new file mode 100644 index 000000000..f068982fc --- /dev/null +++ b/frontend/src/app/pipes/dataset-latest-entry.pipe.ts @@ -0,0 +1,44 @@ +import { Pipe, PipeTransform } from '@angular/core'; +import {ChartDataset} from 'chart.js'; +import * as _ from 'lodash'; + +@Pipe({ + name: 'datasetLatestEntry' +}) +export class DatasetLatestEntryPipe implements PipeTransform { + + transform(dataset: ChartDataset<'line'>, round?: number, valLookupKey?: string, unitLookupKey?: string): string { + if(!round){ + round = 0 //round to nearest whole number + } + let lastItem = dataset?.data?.[dataset?.data?.length -1] || '' + // let valueKey = this.chartOptions?.parsing?.['yAxisKey'] || dataset?.parsing?.['key'] + console.log('latestEntryConfig', lastItem, valLookupKey, unitLookupKey, round) + let lastItemUnit = "" + let lastItemValue + + if(Array.isArray(lastItem)){ + lastItemValue = _.flatten(lastItem?.[0]?.[valLookupKey])?.[0] as string + lastItemUnit = _.flatten(lastItem?.[0]?.[unitLookupKey])?.[0] as string + } else if(typeof lastItem === 'object'){ + console.log('lastItem-object', lastItem?.[valLookupKey]) + lastItemValue = lastItem?.[valLookupKey] + lastItemUnit = lastItem?.[unitLookupKey] + } else { + //do nothing + } + + lastItemValue = this.roundToDecimalPlaces(lastItemValue, round) + if(lastItemUnit){ + return lastItemValue + ' ' + lastItemUnit + } else { + return lastItemValue.toString() + } + } + + + roundToDecimalPlaces(value: string, decimalPlaces: number): string { + return parseFloat(value).toFixed(decimalPlaces).toString() + } + +} diff --git a/frontend/src/app/pipes/pipes.module.ts b/frontend/src/app/pipes/pipes.module.ts index c7ea63f3d..7949cc7d6 100644 --- a/frontend/src/app/pipes/pipes.module.ts +++ b/frontend/src/app/pipes/pipes.module.ts @@ -5,6 +5,7 @@ import { NgModule } from '@angular/core'; import {FhirPathPipe} from './fhir-path.pipe'; import {FilterPipe} from './filter.pipe'; import { ShortDomainPipe } from './short-domain.pipe'; +import { DatasetLatestEntryPipe } from './dataset-latest-entry.pipe'; @NgModule({ declarations: [ @@ -12,6 +13,7 @@ import { ShortDomainPipe } from './short-domain.pipe'; FhirPathPipe, FilterPipe, ShortDomainPipe, + DatasetLatestEntryPipe, ], imports: [ @@ -19,7 +21,8 @@ import { ShortDomainPipe } from './short-domain.pipe'; exports: [ FhirPathPipe, FilterPipe, - ShortDomainPipe + ShortDomainPipe, + DatasetLatestEntryPipe ] }) export class PipesModule {} diff --git a/frontend/src/app/widgets/dashboard-widget/dashboard-widget.component.ts b/frontend/src/app/widgets/dashboard-widget/dashboard-widget.component.ts index f87cf79c2..c6f5130d5 100644 --- a/frontend/src/app/widgets/dashboard-widget/dashboard-widget.component.ts +++ b/frontend/src/app/widgets/dashboard-widget/dashboard-widget.component.ts @@ -121,26 +121,6 @@ export class DashboardWidgetComponent implements OnInit, DashboardWidgetComponen console.log(`Loading COmpleted for ${this.widgetConfig.title_text}, ${this.loading}`) } - getLastDatasetValue(dataset: ChartDataset<'line'>): string { - let lastItem = dataset?.data?.[dataset?.data?.length -1] || '' - let valueKey = this.chartOptions?.parsing?.['yAxisKey'] || dataset?.parsing?.['key'] - console.log('current', lastItem, valueKey) - - if(typeof lastItem === 'string'){ - console.log('lastItem-string', lastItem) - return lastItem - } else if(Array.isArray(lastItem)){ - - return _.flatten(lastItem?.[0]?.[valueKey])?.[0] as string - } else if(typeof lastItem === 'object'){ - console.log('lastItem-object', lastItem?.[valueKey]) - return lastItem?.[valueKey] - } else { - return lastItem.toString() - } - } - - // This function will process the raw response from the Dashboard Query API call, which requires frontend processing of the select clause. // it will call the fhirPathMapQueryFn which will extract FHIRPath values from the resource_raw field of the ResourceFhir object diff --git a/frontend/src/app/widgets/grouped-bar-chart-widget/grouped-bar-chart-widget.component.html b/frontend/src/app/widgets/grouped-bar-chart-widget/grouped-bar-chart-widget.component.html index 7aa131b4d..6479e1ca1 100644 --- a/frontend/src/app/widgets/grouped-bar-chart-widget/grouped-bar-chart-widget.component.html +++ b/frontend/src/app/widgets/grouped-bar-chart-widget/grouped-bar-chart-widget.component.html @@ -12,7 +12,7 @@

{{widgetConfig.title_text}}

-
120/80 mmHg
+
{{chartDatasets?.[0] | datasetLatestEntry: 0:'data' }}/{{chartDatasets?.[1] | datasetLatestEntry: 0:'data' }} mmHg
{{widgetConfig.description_text}}
diff --git a/frontend/src/app/widgets/grouped-bar-chart-widget/grouped-bar-chart-widget.component.ts b/frontend/src/app/widgets/grouped-bar-chart-widget/grouped-bar-chart-widget.component.ts index cc10f642c..4eeaadb16 100644 --- a/frontend/src/app/widgets/grouped-bar-chart-widget/grouped-bar-chart-widget.component.ts +++ b/frontend/src/app/widgets/grouped-bar-chart-widget/grouped-bar-chart-widget.component.ts @@ -5,10 +5,11 @@ import {DashboardWidgetComponent} from '../dashboard-widget/dashboard-widget.com import {CommonModule} from '@angular/common'; import {LoadingWidgetComponent} from '../loading-widget/loading-widget.component'; import {EmptyWidgetComponent} from '../empty-widget/empty-widget.component'; +import {PipesModule} from '../../pipes/pipes.module'; @Component({ standalone: true, - imports: [NgChartsModule, CommonModule, LoadingWidgetComponent, EmptyWidgetComponent], + imports: [NgChartsModule, CommonModule, LoadingWidgetComponent, EmptyWidgetComponent, PipesModule], selector: 'grouped-bar-chart-widget', templateUrl: './grouped-bar-chart-widget.component.html', styleUrls: ['./grouped-bar-chart-widget.component.scss'] diff --git a/frontend/src/app/widgets/simple-line-chart-widget/simple-line-chart-widget.component.html b/frontend/src/app/widgets/simple-line-chart-widget/simple-line-chart-widget.component.html index d8d8c4316..df26c5e78 100644 --- a/frontend/src/app/widgets/simple-line-chart-widget/simple-line-chart-widget.component.html +++ b/frontend/src/app/widgets/simple-line-chart-widget/simple-line-chart-widget.component.html @@ -11,7 +11,7 @@
-
{{getLastDatasetValue(chartDatasets?.[0])}} kg 18.02%
+
{{chartDatasets?.[0] | datasetLatestEntry: 2:'data':'unit' }} 18.02%

{{widgetConfig?.title_text}}

diff --git a/frontend/src/app/widgets/simple-line-chart-widget/simple-line-chart-widget.component.ts b/frontend/src/app/widgets/simple-line-chart-widget/simple-line-chart-widget.component.ts index d69614b77..1b564da33 100644 --- a/frontend/src/app/widgets/simple-line-chart-widget/simple-line-chart-widget.component.ts +++ b/frontend/src/app/widgets/simple-line-chart-widget/simple-line-chart-widget.component.ts @@ -7,10 +7,11 @@ import {ChartConfiguration, ChartDataset, ChartOptions} from 'chart.js'; import {CommonModule} from '@angular/common'; import {LoadingWidgetComponent} from '../loading-widget/loading-widget.component'; import {EmptyWidgetComponent} from '../empty-widget/empty-widget.component'; +import {PipesModule} from '../../pipes/pipes.module'; @Component({ standalone: true, - imports: [NgChartsModule, CommonModule, LoadingWidgetComponent, EmptyWidgetComponent], + imports: [NgChartsModule, CommonModule, LoadingWidgetComponent, EmptyWidgetComponent, PipesModule], selector: 'simple-line-chart-widget', templateUrl: './simple-line-chart-widget.component.html', styleUrls: ['./simple-line-chart-widget.component.scss']