From 1008b31ef62b192b1a88180468a555815cebb098 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Sat, 16 Sep 2023 20:13:42 -0700 Subject: [PATCH] adding a care team widget. --- .../pkg/web/handler/dashboard/testing.json | 9 +++++ .../models/widget/dashboard-widget-config.ts | 2 +- .../image-list-group-widget.component.html | 35 +++++++++++++++++++ .../image-list-group-widget.component.scss | 0 .../image-list-group-widget.component.spec.ts | 23 ++++++++++++ .../image-list-group-widget.component.ts | 35 +++++++++++++++++++ frontend/src/app/widgets/widgets.module.ts | 7 ++-- 7 files changed, 108 insertions(+), 3 deletions(-) create mode 100644 frontend/src/app/widgets/image-list-group-widget/image-list-group-widget.component.html create mode 100644 frontend/src/app/widgets/image-list-group-widget/image-list-group-widget.component.scss create mode 100644 frontend/src/app/widgets/image-list-group-widget/image-list-group-widget.component.spec.ts create mode 100644 frontend/src/app/widgets/image-list-group-widget/image-list-group-widget.component.ts diff --git a/backend/pkg/web/handler/dashboard/testing.json b/backend/pkg/web/handler/dashboard/testing.json index ab2cdf60..3aaa5a59 100644 --- a/backend/pkg/web/handler/dashboard/testing.json +++ b/backend/pkg/web/handler/dashboard/testing.json @@ -12,6 +12,15 @@ "width": 8, "height": 6, "item_type": "records-summary-widget" + }, + { + "title_text": "Care Team", + "description_text": "Track key metrics for your chronic disease (eg. Diabetes). The data within this widget is not reflective of your health record, and is only present for demonstrational purposes.", + "x": 8, + "y": 0, + "width": 4, + "height": 6, + "item_type": "image-list-group-widget" } ] } diff --git a/frontend/src/app/models/widget/dashboard-widget-config.ts b/frontend/src/app/models/widget/dashboard-widget-config.ts index 7fa94a47..c00d735a 100644 --- a/frontend/src/app/models/widget/dashboard-widget-config.ts +++ b/frontend/src/app/models/widget/dashboard-widget-config.ts @@ -3,7 +3,7 @@ import * as _ from 'lodash'; export class DashboardWidgetConfig { id?: string - item_type: "complex-line-widget" | "donut-chart-widget" | "dual-gauges-widget" | "grouped-bar-chart-widget" | "patient-vitals-widget" | "simple-line-chart-widget" | "table-widget" | "records-summary-widget" + item_type: "image-list-group-widget" | "complex-line-widget" | "donut-chart-widget" | "dual-gauges-widget" | "grouped-bar-chart-widget" | "patient-vitals-widget" | "simple-line-chart-widget" | "table-widget" | "records-summary-widget" title_text: string description_text: string diff --git a/frontend/src/app/widgets/image-list-group-widget/image-list-group-widget.component.html b/frontend/src/app/widgets/image-list-group-widget/image-list-group-widget.component.html new file mode 100644 index 00000000..66d790d5 --- /dev/null +++ b/frontend/src/app/widgets/image-list-group-widget/image-list-group-widget.component.html @@ -0,0 +1,35 @@ + + + + + + + + + + + + + diff --git a/frontend/src/app/widgets/image-list-group-widget/image-list-group-widget.component.scss b/frontend/src/app/widgets/image-list-group-widget/image-list-group-widget.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/frontend/src/app/widgets/image-list-group-widget/image-list-group-widget.component.spec.ts b/frontend/src/app/widgets/image-list-group-widget/image-list-group-widget.component.spec.ts new file mode 100644 index 00000000..e385d67e --- /dev/null +++ b/frontend/src/app/widgets/image-list-group-widget/image-list-group-widget.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ImageListGroupWidgetComponent } from './image-list-group-widget.component'; + +describe('ImageListGroupWidgetComponent', () => { + let component: ImageListGroupWidgetComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ ImageListGroupWidgetComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(ImageListGroupWidgetComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/frontend/src/app/widgets/image-list-group-widget/image-list-group-widget.component.ts b/frontend/src/app/widgets/image-list-group-widget/image-list-group-widget.component.ts new file mode 100644 index 00000000..474598de --- /dev/null +++ b/frontend/src/app/widgets/image-list-group-widget/image-list-group-widget.component.ts @@ -0,0 +1,35 @@ +import { Component, OnInit } from '@angular/core'; +import {NgChartsModule} from 'ng2-charts'; +import {CommonModule} from '@angular/common'; +import {LoadingWidgetComponent} from '../loading-widget/loading-widget.component'; +import {EmptyWidgetComponent} from '../empty-widget/empty-widget.component'; +import {DashboardWidgetComponent} from '../dashboard-widget/dashboard-widget.component'; +import {DashboardWidgetConfig} from '../../models/widget/dashboard-widget-config'; + +@Component({ + standalone: true, + imports: [NgChartsModule, CommonModule, LoadingWidgetComponent, EmptyWidgetComponent], + selector: 'image-list-group-widget', + templateUrl: './image-list-group-widget.component.html', + styleUrls: ['./image-list-group-widget.component.scss'] +}) +export class ImageListGroupWidgetComponent extends DashboardWidgetComponent implements OnInit { + + ngOnInit(): void { + //manually define the widget config, rather than pull from the configuration file + this.widgetConfig = { + id: 'image-list-group-widget', + item_type: 'image-list-group-widget', + description_text: 'Displays a summary of patient records', + width: 4, + height: 5, + title_text: 'Medical Records', + queries: [] + + } as DashboardWidgetConfig + super.ngOnInit(); + this.loading = false + this.isEmpty = false + } + +} diff --git a/frontend/src/app/widgets/widgets.module.ts b/frontend/src/app/widgets/widgets.module.ts index ff941ada..f8b12668 100644 --- a/frontend/src/app/widgets/widgets.module.ts +++ b/frontend/src/app/widgets/widgets.module.ts @@ -10,6 +10,7 @@ import { LoadingWidgetComponent } from './loading-widget/loading-widget.componen import { EmptyWidgetComponent } from './empty-widget/empty-widget.component'; import {DashboardWidgetComponent} from './dashboard-widget/dashboard-widget.component'; import { RecordsSummaryWidgetComponent } from './records-summary-widget/records-summary-widget.component'; +import { ImageListGroupWidgetComponent } from './image-list-group-widget/image-list-group-widget.component'; @NgModule({ imports: [ @@ -20,14 +21,14 @@ import { RecordsSummaryWidgetComponent } from './records-summary-widget/records- GroupedBarChartWidgetComponent, PatientVitalsWidgetComponent, RecordsSummaryWidgetComponent, + ImageListGroupWidgetComponent, SimpleLineChartWidgetComponent, TableWidgetComponent, LoadingWidgetComponent, EmptyWidgetComponent ], - declarations: [ - ], + declarations: [], exports: [ //standalone components ComplexLineWidgetComponent, @@ -36,6 +37,7 @@ import { RecordsSummaryWidgetComponent } from './records-summary-widget/records- GroupedBarChartWidgetComponent, PatientVitalsWidgetComponent, RecordsSummaryWidgetComponent, + ImageListGroupWidgetComponent, SimpleLineChartWidgetComponent, TableWidgetComponent, LoadingWidgetComponent, @@ -56,6 +58,7 @@ export function WidgetComponents(): Type[] { GroupedBarChartWidgetComponent, PatientVitalsWidgetComponent, RecordsSummaryWidgetComponent, + ImageListGroupWidgetComponent, SimpleLineChartWidgetComponent, TableWidgetComponent, LoadingWidgetComponent,