From 9ea421a6234cf7b59da358182d009856b594e0ab Mon Sep 17 00:00:00 2001 From: Jean Fernandez Date: Sun, 24 Mar 2024 23:19:53 -0400 Subject: [PATCH] Update observation and report-labs-observation components --- .../observation/observation.component.html | 2 +- .../observation/observation.component.spec.ts | 16 +++++++- .../observation/observation.component.ts | 21 +++++++--- .../observation/observation.stories.ts | 21 +++++++++- .../report-labs-observation.component.html | 4 +- .../report-labs-observation.component.scss | 5 +++ .../report-labs-observation.stories.ts | 40 +++++++++++++++++-- 7 files changed, 94 insertions(+), 15 deletions(-) diff --git a/frontend/src/app/components/fhir-card/resources/observation/observation.component.html b/frontend/src/app/components/fhir-card/resources/observation/observation.component.html index 5922653a4..417ae961e 100644 --- a/frontend/src/app/components/fhir-card/resources/observation/observation.component.html +++ b/frontend/src/app/components/fhir-card/resources/observation/observation.component.html @@ -14,7 +14,7 @@
{{displayModel?.sort_title}}

Observations are a central element in healthcare, used to support diagnosis, monitor progress, determine baselines and patterns and even capture demographic characteristics.

- + -
- +
+
diff --git a/frontend/src/app/components/report-labs-observation/report-labs-observation.component.scss b/frontend/src/app/components/report-labs-observation/report-labs-observation.component.scss index e69de29bb..0e503d0be 100644 --- a/frontend/src/app/components/report-labs-observation/report-labs-observation.component.scss +++ b/frontend/src/app/components/report-labs-observation/report-labs-observation.component.scss @@ -0,0 +1,5 @@ +.visualization-container { + max-height: 20em; + display: inline-block; + overflow: scroll; +} diff --git a/frontend/src/app/components/report-labs-observation/report-labs-observation.stories.ts b/frontend/src/app/components/report-labs-observation/report-labs-observation.stories.ts index 258545b6b..77ca95209 100644 --- a/frontend/src/app/components/report-labs-observation/report-labs-observation.stories.ts +++ b/frontend/src/app/components/report-labs-observation/report-labs-observation.stories.ts @@ -4,7 +4,7 @@ import { DecoratorFunction } from '@storybook/types'; import { ReportLabsObservationComponent } from './report-labs-observation.component' import { PipesModule } from 'src/app/pipes/pipes.module'; import { NgbCollapse } from '@ng-bootstrap/ng-bootstrap'; -import { ResourceFhir } from 'src/app/models/fasten/resource_fhir'; +import { IResourceRaw, ResourceFhir } from 'src/app/models/fasten/resource_fhir'; import { GlossaryLookupComponent } from '../glossary-lookup/glossary-lookup.component'; import { NgChartsModule } from 'ng2-charts'; import { HTTP_CLIENT_TOKEN } from 'src/app/dependency-injection'; @@ -14,7 +14,9 @@ import { Observable, of } from 'rxjs'; import R4Example1Json from "../../../lib/fixtures/r4/resources/observation/example1.json"; import { Html as GlossaryLookupHtml } from '../glossary-lookup/glossary-lookup.stories'; -import { ObservationBarChartComponent } from '../fhir-card/common/observation-bar-chart/observation-bar-chart.component'; +import { ObservationVisualizationComponent } from '../fhir-card/common/observation-visualization/observation-visualization.component'; +import { fhirVersions } from 'src/lib/models/constants'; +import { observationR4Factory } from 'src/lib/fixtures/factories/r4/resources/observation-r4-factory'; const withHttpClientProvider: DecoratorFunction = (storyFunc, context) => { @@ -40,7 +42,7 @@ const meta: Meta = { decorators: [ withHttpClientProvider, moduleMetadata({ - imports: [PipesModule, GlossaryLookupComponent, NgChartsModule, RouterTestingModule, HttpClientModule, ObservationBarChartComponent], + imports: [PipesModule, GlossaryLookupComponent, NgChartsModule, RouterTestingModule, HttpClientModule, ObservationVisualizationComponent], declarations: [ NgbCollapse ], providers: [], }) @@ -100,3 +102,35 @@ export const Entry: Story = { ...GlossaryLookupHtml.parameters } }; + + +const observation3: ResourceFhir = { + source_id: '', + source_resource_id: '', + source_resource_type: 'Observation', + fhir_version: '4', + sort_title: 'sort', + sort_date: new Date(), + resource_raw: observationR4Factory.valueCodeableConcept().build() as IResourceRaw, +}; + +const observation4: ResourceFhir = { + source_id: '', + source_resource_id: '', + source_resource_type: 'Observation', + fhir_version: '4', + sort_title: 'sort', + sort_date: new Date(), + resource_raw: observationR4Factory.valueCodeableConcept().build() as IResourceRaw, +}; + +export const CodableConcept: Story = { + args: { + observations: [observation3, observation4], + observationCode: '788-0', + observationTitle: 'Erythrocyte distribution width [Ratio] by Automated count', + }, + parameters: { + ...GlossaryLookupHtml.parameters + } +};